This problem is no different from sorting a single linked list as two
unsorted linked lists are essentially equivalent to one unsorted linked
list by joining their ends. So just joining the two linked lists and
sorting them will work.

If you don't want to copy the information to an array i.e. space is a
concern , then bubblesort will work within the linked list with O(n^2),
with no extra space requirements

If you have memory to spare, then you can just copy the linked list to
an array and just do mergesort/radixsort etc. to get O(n logn) time
complexity.

If they are really large, then sorting them seperately and merging them
may take less time than merging them first and then sorting them, but
this difference will be in constants...the time complexity will remain
the same.


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to