-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path6-radixSort.js
56 lines (31 loc) · 1.37 KB
/
6-radixSort.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
///////////////////////////////////////////////////////
////////////*** RADIX SORT QUESTION ***////////////
///////////////////////////////////////////////////////
///////////////////////////////////////////////////
//***************RADIX SORT HELPER 1 ************//
///////////////////////////////////////////////////
// getDigit function returns the digit in num at the given place value.
// getDigit(12345,0)//5
// //if the given place is 0, the number at the location 0 is 5.
//the place counts starts from the right to left. 1 -> 10 -> 100 -> 1000 -> 10000 ...
///////////////////////////////////////////////////
//***************RADIX SORT HELPER 2 ************/
///////////////////////////////////////////////////
//how many numbers of numbers are there in the longest number (lol)
//digitCount
///////////////////////////////////////////////////
//***************RADIX SORT HELPER 3 ************/
///////////////////////////////////////////////////
//most Digits which one has the most digits?
///////////////////////////////////////////////////
//******************** RADIX SORT *****************/
///////////////////////////////////////////////////
console.log(radixSort([23, 334, 21, 3421, 1453, 9898, 7323]))
// [
// 21, 23, 334,
// 1453, 3421, 7323,
// 9898
// ]
//explain this sorting method's big O notation
// time complexity:
// space complexity: