@sagar it will take O(n2) if all the elements of linked list are odd and distinct......
On Sat, Jul 16, 2011 at 4:06 PM, sagar pareek <[email protected]> wrote: > i have solution with no extra space complexity but time complexity is >O(n) > > traverse the list with a pointer ptr > if odd no encounter then traverse the remaining list with tmp pointer with > start point ptr->next and match the numbers with it....i hope it works :) > > > On Sat, Jul 16, 2011 at 10:10 AM, shady <[email protected]> wrote: > >> if hashing is allowed then it can be done in O(n)....... space complexity >> in this case again will be O(n)........ this won't work for large numbers... >> >> >> On Sat, Jul 16, 2011 at 1:58 AM, Nishant Mittal < >> [email protected]> wrote: >> >>> @sagar... I know this solution but it was strictly asked to do in O(n) >>> time and O(1) space complexity and what if range of numbers is very >>> large.... >>> >>> >>> On Sat, Jul 16, 2011 at 1:09 AM, sagar pareek <[email protected]>wrote: >>> >>>> You just need to maintain the array for the odd words which encountered >>>> during traversing the list and using hashing this can be done :) but of >>>> course not in O(n) :( >>>> >>>> On Sat, Jul 16, 2011 at 12:51 AM, aseem garg <[email protected]>wrote: >>>> >>>>> Use a Hash Table. >>>>> Aseem >>>>> >>>>> >>>>> >>>>> On Sat, Jul 16, 2011 at 12:28 AM, shady <[email protected]> wrote: >>>>> >>>>>> i don't think it is possible to do it in O(n)... rather not even in >>>>>> O(nlogn) without modifying the list >>>>>> >>>>>> >>>>>> On Fri, Jul 15, 2011 at 11:23 PM, Nishant Mittal < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> How will you delete duplicate odd numbers from a linked list in O(n) >>>>>>> time >>>>>>> >>>>>>> -- >>>>>>> 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. >>>>> >>>> >>>> >>>> >>>> -- >>>> **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. >>>> >>> >>> -- >>> 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. >> > > > > -- > **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. > -- 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.
