Created
January 11, 2018 01:26
-
-
Save nerohoop/65a8b26d0f5e7715e0b785e13c5d59d2 to your computer and use it in GitHub Desktop.
This file contains 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
1. Create a Min Heap of size k+1 with first k+1 elements. This will take O(k) time | |
2. One by one remove min element from heap, put it in result array, and add a new element to heap from remaining elements. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment