in reply to Re^12: In-place sort with order assignment (runs)
in thread In-place sort with order assignment
The logic behind is that there are log N merge steps to perform. In the lower steps the probability of duplicates is very low, so the number of comparisons will be proportional to N. On the other hand, on the high merge steps, the probability of duplicates is very high and so the number of comparisons will be proportional to U.
We can optimistically assume that the mean number of operations per step is (O+N)/2, so the total number of operations becomes proportional to (O+N) / 2 * log N
And obviously, that can be simplified to O(N*log N).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^14: In-place sort with order assignment (runs)
by BrowserUk (Patriarch) on Sep 22, 2010 at 10:30 UTC | |
|
Re^14: In-place sort with order assignment (runs)
by JavaFan (Canon) on Sep 22, 2010 at 09:27 UTC | |
by salva (Canon) on Sep 22, 2010 at 10:09 UTC | |
by JavaFan (Canon) on Sep 22, 2010 at 10:15 UTC |