Skip to content

Fix incorrect and incomplete merge two sorted lists code (Lecture 49 Q2)#608

Open
Rayyan-101 wants to merge 1 commit intoloveBabbar:mainfrom
Rayyan-101:fix-merge-two-sorted-lists-554
Open

Fix incorrect and incomplete merge two sorted lists code (Lecture 49 Q2)#608
Rayyan-101 wants to merge 1 commit intoloveBabbar:mainfrom
Rayyan-101:fix-merge-two-sorted-lists-554

Conversation

@Rayyan-101
Copy link
Copy Markdown

Fixes #554

The previous implementation was incomplete and incorrect:

  • solve() did not return the merged list
  • sortTwoLists() was missing return statements
  • Pointer updates could cause an infinite loop
  • Remaining nodes were not handled correctly

This PR adds a complete, tested in-place merge solution with minimal clarifying comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lecture 49 question2: merge 2 sorted list code is not correct and incomplete

1 participant