in reply to Re^2: Modified Binary Search
in thread Modified Binary Search
Depending on the data set this additional step could eat away any savings from performing a few steps more in the binary search.
Sorry, but that would only be true if a binary search worked on data with duplicates. It doesn't.
So you have to factor in the additional complexity of the basic search plus the steps required to locate the appropriate (upper or lower) boundary of the run of duplicates.
I don't believe it is possible to code a search over sorted data with duplicates that comes even close to be O(log N). Even in theory. And in practical implementations, it'd be far slower.
Feel free to prove me wrong :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Modified Binary Search
by JavaFan (Canon) on Jan 14, 2010 at 11:21 UTC | |
by BrowserUk (Patriarch) on Jan 14, 2010 at 11:55 UTC | |
by salva (Canon) on Jan 14, 2010 at 13:37 UTC | |
by JavaFan (Canon) on Jan 14, 2010 at 13:03 UTC | |
by BrowserUk (Patriarch) on Jan 14, 2010 at 13:06 UTC | |
by BrowserUk (Patriarch) on Jan 16, 2010 at 01:19 UTC | |
| |
by Anonymous Monk on Aug 11, 2011 at 15:30 UTC | |
|
Re^4: Modified Binary Search
by jethro (Monsignor) on Jan 14, 2010 at 14:42 UTC | |
|
Re^4: Modified Binary Search
by Limbic~Region (Chancellor) on Jan 14, 2010 at 15:39 UTC |