{"ScriptPreparationCode":"function radixSort(arr, base = 10) {\r\n const logBase = (n, base = Math.E) =\u003E Math.log(n) / Math.log(base)\r\n const getDigit = (num, i) =\u003E Math.floor(Math.abs(num) / Math.pow(base, i)) % base\r\n const digitCount = (num) =\u003E num === 0 ? 1 : Math.floor(logBase(Math.abs(num), base)) \u002B 1\r\n const mostDigits = (nums) =\u003E nums.reduce((ret, val) =\u003E Math.max(ret, digitCount(val)), 0)\r\n\r\n const maxDigitCount = mostDigits(arr)\r\n\r\n for (let k = 0; k \u003C maxDigitCount; k\u002B\u002B) {\r\n let digitBuckts = Array.from({\r\n length: base\r\n }, () =\u003E [])\r\n\r\n for (let i = 0; i \u003C arr.length; i\u002B\u002B) {\r\n digitBuckts[getDigit(arr[i], k)].push(arr[i])\r\n }\r\n\r\n arr = [].concat(...digitBuckts)\r\n }\r\n\r\n return arr\r\n}\r\n\r\nconst arr = Array.from({\r\n length: 10000\r\n}, () =\u003E Math.floor(Math.random() * 10_000_000_000_000))","TestCases":[{"Name":"base 2","Code":"const x = radixSort(arr, 2)","IsDeferred":false},{"Name":"base 8","Code":"const x = radixSort(arr, 8)","IsDeferred":false},{"Name":"base 10","Code":"const x = radixSort(arr, 10)","IsDeferred":false},{"Name":"base 16","Code":"const x = radixSort(arr, 16)","IsDeferred":false},{"Name":"base 256 (2^8)","Code":"const x = radixSort(arr, 256)","IsDeferred":false},{"Name":"base 512 (2^9)","Code":"const x = radixSort(arr, 512)","IsDeferred":false},{"Name":"base 1024 (2^10)","Code":"const x = radixSort(arr, 1024)","IsDeferred":false},{"Name":"base 2048 (2^11)","Code":"const x = radixSort(arr, 2048)","IsDeferred":false},{"Name":"base 4096 (2^12)","Code":"const x = radixSort(arr, 4096)","IsDeferred":false},{"Name":"base 8192 (2^13)","Code":"const x = radixSort(arr, 8192)","IsDeferred":false},{"Name":"base 16384 (2^14)","Code":"const x = radixSort(arr, 16384)","IsDeferred":false},{"Name":"base 32768 (2^15)","Code":"const x = radixSort(arr, 32768)","IsDeferred":false},{"Name":"base 65536 (2^16)","Code":"const x = radixSort(arr, 65536)","IsDeferred":false}]}