Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
|
|
@ -0,0 +1,19 @@
|
|||
proc countsort min max . d[] .
|
||||
len count[] max - min + 1
|
||||
for n in d[]
|
||||
count[n - min + 1] += 1
|
||||
.
|
||||
z = 1
|
||||
for i = min to max
|
||||
while count[i - min + 1] > 0
|
||||
d[z] = i
|
||||
z += 1
|
||||
count[i - min + 1] -= 1
|
||||
.
|
||||
.
|
||||
.
|
||||
for i = 1 to 100
|
||||
d[] &= random 1000
|
||||
.
|
||||
countsort 1 1000 d[]
|
||||
print d[]
|
||||
|
|
@ -30,7 +30,7 @@ extension op
|
|||
|
||||
public program()
|
||||
{
|
||||
var list := new Range(0, 10).selectBy:(i => randomGenerator.eval(10)).toArray();
|
||||
var list := new Range(0, 10).selectBy:(i => randomGenerator.nextInt(10)).toArray();
|
||||
|
||||
console.printLine("before:", list.asEnumerable());
|
||||
console.printLine("after :", list.countingSort().asEnumerable())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue