Questions tagged [radix-sort]

Radix sort is a sorting algorithm which sorts key/value pairs with integer keys by ordering digits.

307 questions
4
votes
1 answer

american flag sort optimization

I am trying to implement American Bucket Sort. Wiki says "first to count the number of objects that will fall in each bin, and second to place each object in its bucket." In second phase, when placing objects in proper buckets, Do I need to use…
bfaskiplar
  • 795
  • 6
  • 20
4
votes
4 answers

What constitutes 'array access' in the context of algorithms?

Below is an LSD Radix sort implementation in Java from a textbook to sort an array of strings where each string contains exactly W characters. I want to count the number of array accesses during runtime. I've read that LSD sort is supposed to…
Lawyerson
  • 919
  • 1
  • 9
  • 22
4
votes
2 answers

Is radix sort the only non-comparison sorting algorithm?

As the title says, is radix sort the only non-comparison sorting algorithm? My guess is yes.
paul paul
  • 93
  • 1
  • 5
4
votes
1 answer

radix sort in c on floating points numbers

Okay so I have to create a radix sort for both unsigned ints and floating point numbers. My unsigned ints version works as it should, I am having a little trouble getting it to work for floating points values though. Basically it sorts the values of…
mike
  • 2,849
  • 6
  • 28
  • 33
4
votes
2 answers

explanation about a Java implementation of radix sort

I'm reading and learning about a Java implementation of radix sort, as shown below. It would be great if someone could clarify the logical meaning of pointTo, index and…
Lin Ma
  • 8,271
  • 25
  • 84
  • 152
4
votes
2 answers

Python Radix Sort

I'm trying to implement Radix sort in python. My current program is not working correctly in that a list like [41,51,2,3,123] will be sorted correctly to [2,3,41,51,123], but something like [52,41,51,42,23] will become [23,41,42,52,51] (52 and 51…
ytpillai
  • 3,194
  • 25
  • 43
4
votes
2 answers

Any ready-made implementation of Radix Sort for C#?

Preferrably with any non-virus open source license
skevar7
  • 969
  • 1
  • 10
  • 21
4
votes
1 answer

How many comparisons are needed in worst case if we have to sort 7 numbers each of 4 digit?

How many comparisons are needed in worst case if we have to sort 7 numbers each of 4 digit ?(Radix sort) Options are- 40,38,47,280 . My solution-I have taken 10 buckets( 0 to 9)(linked list) . Then for every number for ith digit I have put it into…
Manish
  • 744
  • 1
  • 9
  • 18
3
votes
2 answers

On the efficiency of tries and radix sort

Radix sort's time complexity is O(kn) where n is the number of keys to be sorted and k is the key length. Similarly, the time complexity for the insert, delete, and lookup operations in a trie is O(k). However, assuming all elements are distinct,…
Derek
  • 101
  • 1
  • 7
3
votes
1 answer

Radix Sort Best and Worst Case Time Cost Analysis

When Radix sort is used with a stable sort (counting sort, specifically), the best and worst case time costs for Radix sort are usually both given by Theta(d(n+k)), where d is the number of digits for each number to be sorted and k is the number of…
3
votes
2 answers

Radix Sort in JavaScript

I've come up with the following but it predictably doesn't work. var t = new Array(a.length); var r = 4; var b = 64; var count = new Array(1<
Josh K
  • 26,152
  • 19
  • 79
  • 130
3
votes
2 answers

Radix sort in linear time vs. converting input to proper base

I was thinking about the linear time sorting problem which appears in quite a few sources which prompts you to sort an array of numbers in the range from 0 to n^3-1 in linear time. So one way to do this is to use radix sort which normally runs in…
Straightfw
  • 1,995
  • 2
  • 22
  • 36
3
votes
3 answers

String Radix Sort - StringIndexOutOfBoundsEception

I am writing my own Radix Sort method to sort the words in a String (the big black cat sat on the  beautiful brown mat would be sorted as beautiful big black brown cat mat on sat the the). The method takes in a List (my own List interface) of the…
KOB
  • 3,062
  • 1
  • 24
  • 60
3
votes
2 answers

most significant v.s. least significant radix sort

If I just need to sort strings composed by ASCII characters, wondering what are the differences between using most significant v.s. least significant radix sorting? I think they should have the same results, but confused by the following statement…
Lin Ma
  • 8,271
  • 25
  • 84
  • 152
3
votes
2 answers

how is the most significant bit radix sort more efficient than the least significant bit radix sort?

I was just reading the following question: Radix sort most significant first or least significant, which is faster? And the author of the accepted answer was suggesting that the MSD radix sort is indeed faster. I do not see why however. I have…
jsguy
  • 1,789
  • 1
  • 18
  • 34
1 2
3
20 21