@shady...if modfying is not allowed....in that case i think O(n^2) is the only option left with us...sorting can't be used in that case...
On Wed, Jul 13, 2011 at 9:01 PM, shady <[email protected]> wrote: > @nicks so many problems could be solved in O(n) but it is very difficult to > find a hashing function where there is no collision... > and if we sort the list, we are modifying the list... which lets assume is > not allowed............. then what to do ? > suppose even if we know the index at which there are duplicates for every > unique number even then the solution will be O(n^2) because you cant jump > directly to that index > > > On Wed, Jul 13, 2011 at 8:52 PM, nicks <[email protected]> wrote: > >> agree with saurabh.....merge sort will be the best.....using sorting >> problem can be solved in O(nlogn) >> else use hashing to solve in O(n) >> >> @shady.....ya that would be most obvious solution can be done easily in >> O(n^2). >> >> On Wed, Jul 13, 2011 at 8:36 PM, shady <[email protected]> wrote: >> >>> what are the constraints ? >>> if none then it could be done easily. O(N^2) solution >>> >>> On Wed, Jul 13, 2011 at 8:10 PM, Anika Jain <[email protected]>wrote: >>> >>>> how to remove duplicates from a linked list?? is it mandatory to sort >>>> the list first?l >>>> >>>> -- >>>> 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. >> > > -- > 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.
