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 <sinv...@gmail.com> 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 < > mittal.nishan...@gmail.com> 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 <sagarpar...@gmail.com>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 <ase.as...@gmail.com>wrote: >>> >>>> Use a Hash Table. >>>> Aseem >>>> >>>> >>>> >>>> On Sat, Jul 16, 2011 at 12:28 AM, shady <sinv...@gmail.com> 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 < >>>>> mittal.nishan...@gmail.com> 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 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?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 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?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 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?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 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?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 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?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 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?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 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?hl=en.