Merge Lists

Basic operation of merging two or more linked list.

Merge Two Sorted Lists

🟢lc21

Time Complexity: O(N) Space Complexity: O(N)

Merge k Sorted Lists

🔴lc23

Assuming N(n*k) is the total number of nodes, n is the size of each linked list, and k is the total number of linked lists.

Time Complexity: O(Nlogk) or O(nklogk) Space Complexity: O(N) or O(nk)

results matching ""

    No results matching ""