We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
const radixSort = (arr, maxDigit) => { let mod = 10, mul = 1 const buckets = new Array(maxDigit).fill(0).map(() => []) for (let i = 0; i < maxDigit; i++, mod *= 10, mul *= 10) { for (const num of arr) { const bucketIdx = Math.floor((num % mod) / mul) if (!buckets[bucketIdx]) buckets[bucketIdx] = [] buckets[bucketIdx].push(num) } // 收集回原数组 let idx = 0 for (let j = 0; j < buckets.length; j++) { if (buckets[j]) { for (let k = 0; k < buckets[j].length; k++) { arr[idx++] = buckets[j][k] } } buckets[j] = [] } } return arr }
Sorry, something went wrong.
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: