My Blog List

[Leetcode Solution] Insertion Sort List

Good Problem

Analysis

  • Problem is straightforward. Iterate all the nodes in the linked list. Find out the proper position then insert it.
  • Dealing with insert or delete operations on linked list attention should be paid that both of the previous and successive pointer need to be known
  • Dealing with linked list problem, attention should be paid to edge conditions like list head, tail and null pointers
  • When in-place algorithm is used, more cautious should have especially combined with pointer. Because the status of the data might be changed by other unnoticed operation. Always double check if the program status is the same as what you think when update manipulate it.

Note

  • Operate insertion on linked list facing in-place algorithm

Code

No comments:

Post a Comment

Enter you comment