mergesort - Merge sorting with linked chains in java -
I'm looking for a template to merge two linked chains already sorted. I'm still quite new to Java, and this is a very challenging task to complete with limited knowledge. I understand how to unify an array, but when it comes to linked lists, I think that is to paint the blank space. I can give you all with any help, this is real The code can be done or just where to start from, it will be highly appreciated.
Thank you for your time!
If two linked lists have already been sorted, then merge them together It's so easy I'll tell you the algorithm, but you have to write your code because it seems that this is a school project. First of all, you create a new linked list, and then assign the head of the new list to reduce the list 1, Lead 2 and List 2 head, then you just run on two lists, each time from the current list Make the minimum selection of the list and add the newly created list, make the current. Next if it was chosen. If there are no more nodes in the list, then the second list is added directly to the second list
Comments
Post a Comment