Last active
August 29, 2015 14:04
-
-
Save kartikkukreja/2f6ffbdf1277008b5f3b to your computer and use it in GitHub Desktop.
Multiway merge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Let H be a min heap of size m | |
add first element of each list to H | |
Let O be the output list | |
while !H.empty() | |
e = H.deleteMin() | |
add e to O | |
add to H the next element of the list e was taken from | |
return O |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment