알고리즘
[알고리즘]Sorting Algorithm_RadixSort
stonesy
2022. 4. 23. 16:43
728x90
void radixsort(node_pointer& masterlist, int numdigits){
index i;
node_pointer list[0...9];
for(i=1;i<=numdigits;i++){
distribution(masterlist, i);
coalesce(masterlist);
}
}
void distribution(node_pointer& masterlist, index i){
index j;
node_pointer p;
for(j=0;j<=9;j++)
list[j]=NULL;
p=masterlist;
while(p!=NULL){
j=p->key의 ith number;
link p to the end of list[j];
p=p->link;
}
}
void coalesce(node_pointer& masterlist){
index i;
for(i=0;i<=9;i++){
link list[j] to the end of masterlist;
}
}
728x90