Created
February 17, 2020 15:41
-
-
Save ileasile/5d12391db74f6a7e4cf86ba82402d6fa to your computer and use it in GitHub Desktop.
Pascal abc sorted set
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure printSet<T>(s: SortedSet<T>); | |
begin | |
foreach e: T in s do | |
begin | |
Print(e); | |
Print(' '); | |
end; | |
Println(); | |
end; | |
begin | |
var N: integer; | |
Readln(N); | |
var a := new SortedSet<integer>(); | |
for var i := 0 to (N-1) do | |
begin | |
a.add(Random(100)); | |
end; | |
for var i:= 1 to N do | |
begin | |
printSet(a); | |
var m := a.min; | |
Print('Min: '); | |
Println(m); | |
a.Remove(m); | |
end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment