Skip to content
This repository was archived by the owner on Oct 2, 2021. It is now read-only.

Create Merge K Sorted Lists.java #121

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jyotidhatarwal
Copy link
Contributor

Merge K Sorted Lists code in java

Constraints
Space complextiy = O(k)
Time complexity = nlogk
where k is the number of lists and n is number of elements across all lists.

Sample input:
4
5
10 20 30 40 50
7
5 7 9 11 19 55 57
3
1 2 3
2
32 39

Sample output:
1 2 3 5 7 9 10 11 19 20 30 32 39 40 50 55 57

Merge K Sorted Lists code in java

Constraints
Space complextiy = O(k)
Time complexity = nlogk
where k is the number of lists and n is number of elements across all lists.

Sample input:
4
5
10 20 30 40 50
7
5 7 9 11 19 55 57
3
1 2 3
2
32 39

Sample output:
1 2 3 5 7 9 10 11 19 20 30 32 39 40 50 55 57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant