all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,12 @@
|
|||
countingSort[list_] := Module[{minElem, maxElem, count, z, number},
|
||||
minElem = Min[list]; maxElem = Max[list];
|
||||
count = ConstantArray[0, (maxElem - minElem + 1)];
|
||||
For[number = 1, number < Length[list], number++,
|
||||
count[[number - minElem + 1]] = count[[number - minElem + 1]] + 1;] ;
|
||||
z = 1;
|
||||
For[i = minElem, i < maxElem, i++,
|
||||
While[count[[i - minElem + 1]] > 0,
|
||||
list[[z]] = i; z++;
|
||||
count[[i - minElem + 1]] = count[[i - minElem + 1]] - 1;]
|
||||
];
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue