Skip to content

Commit 8481c6d

Browse files
authored
Update merge.cpp
1 parent 524c712 commit 8481c6d

1 file changed

Lines changed: 0 additions & 13 deletions

File tree

src/4_Lists/merge.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,6 @@
33
*
44
* MERGE TWO SORTED LINKED LISTS
55
*
6-
* Merge two sorted linked lists into a single sorted list. Two solutions are
7-
* provided:
8-
*
9-
* 1. Optimal (Two-Pointer) Solution:
10-
* - Uses two indices to traverse both lists simultaneously, appending the
11-
* smaller element at each step.
12-
* - Time Complexity: O(n + m) where n and m are the sizes of the two lists.
13-
*
14-
* 2. Alternative (Concatenate and Sort) Solution:
15-
* - First concatenates both lists into one, then sorts the resulting list.
16-
* - Simpler to implement but less efficient due to the sorting step.
17-
* - Time Complexity: O((n + m) log(n + m))
18-
*
196
* ASCII Illustration:
207
*
218
* List1: 1 -> 3 -> 5

0 commit comments

Comments
 (0)