Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
{$mode objfpc}
Program fclstlset;
uses gvector, gset, gutil, dos;
type iLess = specialize TLess<longint>;
iVector = specialize TVector<longint>;
iSet = specialize TSet<longint,iLess>;
var V : iVector;
S : iSet;
N, i : longint;
it : iSet.TIterator;
hour,min,sec,msec,usec : word;
begin
read(N);
V := iVector.Create();
for i:=1 to N do V.PushBack(random(N));
GetTime(hour,min,sec,msec);
Writeln ('Time : ',hour,':',min,':',sec,':',msec);
S := iSet.Create();
for i:=0 to N-1 do S.Insert(V[i]);
V.Clear();
it := S.Min();
GetTime(hour,min,sec,msec);
Writeln ('Time : ',hour,':',min,':',sec,':',msec);
repeat V.PushBack( it.GetData() ); until not it.Next();
WriteLn('OK - ', V.Size())
end.
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more