Summary of common interview questions for LeetCode linked list operation

  1. List sort (insertion sort, merge sort)

    LeetCode#147 LeetCode#148

    1.1 Insertion sort: define three pointers pre, curr, next, and insert curr between pre and pre.next

    [Insertion Sort Ideas and Codes]
    ( http://blog.csdn.net/u012559634/article/details/70238324 )

    1.2 Merge sort: define two pointers, one moves one step at a time, one moves two steps at a time, then the slow moving pointer is finally moved to the middle of the linked list, and then the idea of ​​recursive divide and conquer is adopted

    [Merge sort ideas and code]
    ( http://blog.csdn.net/u012559634/article/details/70231947 )

  2. Merge two sorted lists
    LeetCode#21

    [Ordered Linked List Merge]
    ( http://blog.csdn.net/u012559634/article/details/70488583 )

  3. Linked List Intersection
    LeetCode#160

    [Find the starting node of the intersection of two linked lists]
    ( http://blog.csdn.net/u012559634/article/details/70491456 )

  4. Reverse linked list
    LeetCode#206 Sword refers to offer interview question 16
    [reverse singly linked list]
    ( http://blog.csdn.net/u012559634/article/details/70493743 )

  5. Print the linked list from end to end and point to
    offer interview question 5

  6. Linked list partition
    LeetCode#86. Partition List

    [Given x, put the linked list larger than x to the right of x, and smaller than x to the left of x]
    ( http://blog.csdn.net/u012559634/article/details/70306545 )

  7. Delete the linked list node
    LeetCode#237. Delete Node in a Linked List refers to offer interview question 13

    [Delete a node in the linked list]
    ( http://blog.csdn.net/u012559634/article/details/70510814 )

  8. Delete a node in the linked list that is equal to a value
    LeetCode#203. Remove Linked List Elements

    [Remove all nodes with value x]
    ( http://blog.csdn.net/u012559634/article/details/70514500 )

  9. Determine whether the linked list is a palindrome (the values ​​of the linked list nodes are all integers)
    LeetCode#234. Palindrome Linked List

    Reverse the linked list in the first half
    [linked list palindrome judgment]
    ( http://blog.csdn.net/u012559634/article/details/70521486 )

  10. The linked list is rearranged
    LeetCode#143.Reorder List
    [The linked list is reordered according to the rules (the rule is that the next pointer of the first element points to the first-to-last element, and the next pointer of the second element points to the second-to-last element, according to this rule Pointer adjustment in sequence)]

    (http://blog.csdn.net/u012559634/article/details/71023263)

  11. Delete the nth last element of the linked list
    LeetCode#19. Remove Nth Node From End of List
    refers to offer interview 15: Find the kth last element in the
    linked list [remove the last nth element of the linked list]
    ( http://blog.csdn. net/u012559634/article/details/72853933 )

  12. Topics related to singly linked lists and rings (whether the singly linked list has a ring, the starting point of the singly linked list ring, the length of the singly linked list ring, whether the two linked lists intersect)
    LeetCode#141 LeetCode#142
    Topic summary blog link, please click here, okay?

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325606572&siteId=291194637