This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: The algorithm runs in phases, one phase for each position in the given strings, starting from the least signiFcant character. In each phase, the strings are sorted into groups according to the position under consideration. It is important to make sure that the ordering with respect to a phase is not disturbed in subsequent phases. 1 The algorithm in more detail: radixSort(theArray: array of strings) identify the size n of theArray and the longest string size d for (j = d down to 1) { Initialize 26 groups to empty Initialize a counter for each group to 0 for (i = 0 through n  1) { k = jth letter of theArray[i] Place theArray[i] at the end of group k Increase kth counter by 1 } Replace the strings in theArray with all the strings in group 0, followed by the strings in group 1, and so on } What is the worstcase complexity of radix sort? 2...
View
Full Document
 Spring '11
 NIL
 Algorithms, Data Structures, Sort, theArray, worst case complexity

Click to edit the document details