Difference between pages "4.45" and "4.47"

From The Algorithm Design Manual Solution Wiki
(Difference between pages)
Jump to navigation Jump to search
(Created page with " Back to Chapter 4")
 
(Created page with " For a known set of integer numbers ( assume Nr-1, Nr-2 ... Nr-k) the best is to use a non-comparison based sort algorithm like radix sort with O(n) You have an array that cr...")
 
Line 1: Line 1:
 +
 +
For a known set of integer numbers ( assume Nr-1, Nr-2 ... Nr-k) the best is to use a non-comparison based sort algorithm like radix sort with O(n)
 +
 +
You have an array that creates a histogram of all numbers ( histoThenStartIndexArray[Nr-i]++)
 +
 +
Step 2, in the same array calculate the index of that position
 +
For example if there are 3 numbers 99, and 5 numbers 105, the next index will be 8 for the next number
 +
 +
Step 3, parse array and display values
  
  
 
Back to [[Chapter 4]]
 
Back to [[Chapter 4]]

Latest revision as of 18:34, 20 September 2020

For a known set of integer numbers ( assume Nr-1, Nr-2 ... Nr-k) the best is to use a non-comparison based sort algorithm like radix sort with O(n)

You have an array that creates a histogram of all numbers ( histoThenStartIndexArray[Nr-i]++)

Step 2, in the same array calculate the index of that position For example if there are 3 numbers 99, and 5 numbers 105, the next index will be 8 for the next number

Step 3, parse array and display values


Back to Chapter 4