Skip to content

Instantly share code, notes, and snippets.

@jianminchen
Created August 4, 2018 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jianminchen/7b82c025a381a57d9f2d6ad5b9c7be8a to your computer and use it in GitHub Desktop.
Save jianminchen/7b82c025a381a57d9f2d6ad5b9c7be8a to your computer and use it in GitHub Desktop.
List of iterators - discussion
[[1,2][3,4,5][6,7]] -> non decreasing order
^ ^ ^
Iterator{
bool HasNext()
T Next()
}
while(itr.hasNext()){
itr.next();
}
for(int i : list){
}
// if lists are not sorted , put everything into a BST ...
// k is the number of iterators
// avg list is of size m
// km elements
//if lists are not sorted then heap size must be km,,,
If all lists are sorted, and then only put at most size of iterators into the minimum heap. Using customized comparator
to maintain the minimum heap.
//merge k sorted arrays ..
// leetcode slide window maximum -
// practice leetcode design section ..
//https://leetcode.com/tag/design/
//https://leetcode.com/tag/backtracking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment