Re: [algogeeks] Re: There is an array and the distance between any two consequent elements is one(+1 or -1) and given a number. You have to check whether the number is in array or not with minimum com

2011-08-30 Thread kARTHIK R
Good solution by Dave. Karthik R, RD Engineer, Tejas Networks. On Tue, Aug 30, 2011 at 11:23 AM, Anup Ghatage ghat...@gmail.com wrote: @Dave Your algo's average case working should be better than a naive O(n).. -- Anup Ghatage -- You received this message because you are subscribed to

Re: [algogeeks] Re: There is an array and the distance between any two consequent elements is one(+1 or -1) and given a number. You have to check whether the number is in array or not with minimum com

2011-08-29 Thread Anup Ghatage
@tech Could you give an example for this? If I've understood the question correctly, if we are not allowed duplicates in the array the array turns out to be sorted. If we are allowed duplicates, do we return the first occurrence ? @Dave What would be the complexity of your solution? -- You

Re: [algogeeks] Re: There is an array and the distance between any two consequent elements is one(+1 or -1) and given a number. You have to check whether the number is in array or not with minimum com

2011-08-29 Thread tech coder
an example array 35,36,37,36,37,38,39,40,39,40,41,42,43,42 etc array need not to be sorted. the complexity of Dave algo is O(N) in worst case , when element is not present in the array.m i right Dave On Tue, Aug 30, 2011 at 11:02 AM, Anup Ghatage ghat...@gmail.com wrote: @tech Could you

Re: [algogeeks] Re: There is an array and the distance between any two consequent elements is one(+1 or -1) and given a number. You have to check whether the number is in array or not with minimum com

2011-08-29 Thread Anup Ghatage
@Dave Your algo's average case working should be better than a naive O(n).. -- Anup Ghatage -- 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