Skip to content

Commit 6d3c096

Browse files
committed
Implement digit count method for radix sort
1 parent 8d6c6d4 commit 6d3c096

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sorting/RadixSort.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ function getDigit(num, position) {
22
num = String(num);
33
return position + 1 > num.length ? 0 : Number(num[num.length - 1 - position]);
44
}
5+
6+
function digitCount(num) {
7+
num = String(parseInt(num));
8+
return num.length;
9+
}

0 commit comments

Comments
 (0)