probably the only entirey different approach ( except small variations in
Bsearch ) is use of Hashing ( or for that matter , HashMaps )
On Sun, Oct 25, 2009 at 1:36 PM, harit agarwal agarwalha...@gmail.comwrote:
the only other way can be the jump exponentially during search as in binary
search
Do a binary search
On Sun, Oct 25, 2009 at 12:13 AM, naren lalavat38na...@gmail.com wrote:
You have a sorted array of n elements some of them occur more than
once. How can we find the index of an element in time t which is less
than O(n).
--
Luv,
S.Antony Vincent Pandian
yeah i've solved it using binary search but i want to know more
solutions
On Oct 25, 10:59 am, Antony Vincent Pandian.S. sant...@gmail.com
wrote:
Do a binary search
On Sun, Oct 25, 2009 at 12:13 AM, naren lalavat38na...@gmail.com wrote:
You have a sorted array of n elements some of them
the only other way can be the jump exponentially during search as in binary
search a[mid] is checked so if a[mid]!=x then make low=highest index of
a[mid]!=x this will reduce the comparisionsin binary search
ex-1,1,1,2,2,2,3,3,3,4,4,5,5(13 elements)
let's search for 4
modify binary search