Re: [algogeeks] finding element in array with minimum of comparing

2012-10-06 Thread Kalidhakani J
@umer - what if the element to be searched is at the middle of the array? your code doesn't handles this. check out. On Sat, Oct 6, 2012 at 3:38 AM, icy` wrote: > nice solution, Dave! > > @Umer -- if the sought ele is first, then Dave's code has it sitting in > the variable temp for a little whi

Re: [algogeeks] finding element in array with minimum of comparing

2012-10-03 Thread Kalidhakani J
@umer : also ur code wont work if the searching element is at the middle of the array... On Tue, Oct 2, 2012 at 11:43 PM, atul anand wrote: > @umer : how no. of comparison are reduced to half by moving both > sidesyou have 2 if condition inside, so you are making 2 > comparisons at each iter