int lol=2; // total lol's encountered upto now lol++;
On Mon, Aug 15, 2011 at 12:41 AM, aditi garg <[email protected]>wrote: > lol > > > On Mon, Aug 15, 2011 at 12:40 AM, aditya kumar < > [email protected]> wrote: > >> @aditi : sry i dint realise that n > log n .:P >> >> On Mon, Aug 15, 2011 at 12:38 AM, aditi garg >> <[email protected]>wrote: >> >>> @aditya : dis is obviously correct bt here complexity will be O(n) bt we >>> are asked to gv O(log n) solution >>> >>> On Mon, Aug 15, 2011 at 12:37 AM, aditya kumar < >>> [email protected]> wrote: >>> >>>> for(j=0;j<n;j++) >>>> { >>>> if(a[j]==j) >>>> return j; >>>> else >>>> continue ; >>>> } >>>> >>>> this shud also be correct right ?? >>>> >>>> On Mon, Aug 15, 2011 at 12:31 AM, Akash Mukherjee >>>> <[email protected]>wrote: >>>> >>>>> just my 2 cents ---- in d binary search, replacing key with mid, ie >>>>> if(a[mid] > mid) >>>>> check lower half >>>>> else upper half >>>>> >>>>> should work?? >>>>> >>>>> >>>>> On Mon, Aug 15, 2011 at 12:26 AM, aditi garg < >>>>> [email protected]> wrote: >>>>> >>>>>> Given an ordered array A[1…n] with numbers in strictly increasing >>>>>> order. Find a ‘j’ such that A [j]=j or -1 if no such number exist in >>>>>> o (log n). >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Algorithm Geeks" group. >>>>>> To post to this group, send email to [email protected]. >>>>>> To unsubscribe from this group, send email to >>>>>> [email protected]. >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>>> >>>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Algorithm Geeks" group. >>>>> To post to this group, send email to [email protected]. >>>>> To unsubscribe from this group, send email to >>>>> [email protected]. >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>> >>> >>> >>> -- >>> Aditi Garg >>> Undergraduate Student >>> Electronics & Communication Divison >>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY >>> Sector 3, Dwarka >>> New Delhi >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > Aditi Garg > Undergraduate Student > Electronics & Communication Divison > NETAJI SUBHAS INSTITUTE OF TECHNOLOGY > Sector 3, Dwarka > New Delhi > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
