- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExampleUsage.js
More file actions
Latest commit
24 lines (19 loc) · 691 Bytes
/
Copy pathExampleUsage.js
File metadata and controls
24 lines (19 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
functionsimpleUsageExampleOfRadixSortLSD(){
vararrayToBeSorted=[99,1999999999,51,23,102];
varsortedArray=radixSortLSD(arrayToBeSorted);
for(var_current=0;_current<sortedArray.length;_current++){
console.log(sortedArray[_current]);
}
}
functioncompareIDs(a,b){returna.id-b.id;}
functiongetKey(elementA){returnelementA.id;}
functionjavaScriptSortingObjectsExample()
{
constpeople=[
{person: 'George',id: 2},
{person: 'Alexa',id: 4},
{person: 'David',id: 1}
];
//console.log(people.sort(compareIDs)); // built-in JavaScript sort usage example
console.log(radixSortLSD(people,getKey));// LSD Radix sort usage example
}