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 comparisions....in 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 a[mid]=3 // !=4 such that mid=highest index of 3 in array and make low=mid+1 this way it can be done....just modify binary search.
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---