forked from DragonSpit/JavaScriptAlgorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExampleUsage.js
More file actions
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
function simpleUsageExampleOfRadixSortLSD() {
var arrayToBeSorted = [ 99, 1999999999, 51, 23, 102];
var sortedArray = radixSortLSD(arrayToBeSorted);
for ( var _current = 0; _current < sortedArray.length; _current++ ) {
console.log(sortedArray[_current]);
}
}
function compareIDs(a, b) { return a.id - b.id; }
function getKey(elementA) { return elementA.id; }
function javaScriptSortingObjectsExample()
{
const people = [
{ 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
}