Home > Back-end >  A question about the list merge
A question about the list merge

Time:09-20

https://blog.csdn.net/weixin_39688949/article/details/78472246
Original post is here, why do list to merge, elected to a first put first, and then recycled into the rest of the nodes.
(merge function part of the line 40 comments)

CodePudding user response:

Merge sort is the premise of two or more linked list, array, or is already sorted, put the smallest in the front

CodePudding user response:

reference 1/f, Simple, Soft reply:
merge sort is the premise of two or more lists or arrays, is already sorted, put the smallest in the front of
why not directly through the cycle began to insert nodes inside ah.. But to separate it in a first

CodePudding user response:

Can use cycle, and is generally use loop to compare the size of each element, and that's just his one implementation

CodePudding user response:

I saw a few online seem to write so.. Feelings will not because what reason must be so.
  • Related