首页 > 代码库 > Radix Sort
Radix Sort
1. When we are sorting the numbers we will first find the number of digits in the biggest number.
2. If there are N digits in the biggest number then we will need to perform N number of pass.
3. We will pad the remaining numbers with leading zeros so they all have N digits.
4. Then we will take 10 buckets labeled 0 to 9 and sort the numbers.
Time Complexity : O(N*n) where N is the digits of the biggest number, and n is the length of the array.
Space Complexity: O(1), it will take 10 buckets.
https://www.youtube.com/watch?v=YXFI4osELGU
Radix Sort
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。