Skip to content

Update: 23-merge-k-sorted-lists.java #2416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2023
Merged

Update: 23-merge-k-sorted-lists.java #2416

merged 1 commit into from
Apr 24, 2023

Conversation

Dhanoosh
Copy link
Contributor

@Dhanoosh Dhanoosh commented Apr 15, 2023

Description:

  • The existing algorithm in this java file used a minHeap to store all nodes, leading to a space complexity of O(N*K) but mention it as O(K) which is incorrect.
  • The updated logic now stores only K nodes in the heap at any given moment, improving the space complexity to O(K).

@Dhanoosh Dhanoosh changed the title Modified: 23-merge-k-sorted-lists.java Update: 23-merge-k-sorted-lists.java Apr 15, 2023
@a93a a93a merged commit 7b20581 into neetcode-gh:main Apr 24, 2023
@a93a
Copy link
Collaborator

a93a commented Apr 24, 2023

Good catch!

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.

2 participants