Personal Notes

  • Hashing implements insert, delete and traversal in O(1) average and O(N) in worst case.

  • Python set() is implemented as a hash table. So, lookup/insert/delete in O(1) average and O(N) in worst case.

  • Given a rod of some length L, and a list of possible cuts that could be made. Give the minimum number of cuts to be made to break the rod into pieces of length as in the list.

  • you will be given a stream of numbers and as each number is getting added you will have to keep track of k largest elements.

  • Given an array of integers, you can take three consecutive indices and right shift them. Calculate the number of times this is has to done to make the array sorted, return -1 if it can't be done.

  • Given a matrix of integers which is sorted row wise and column wise check if a number is present in the matrix or not. (Binary Search)

  • Given a list of words, check if a word is present in the list or not. return boolean answer. Ans: Multiple approach question. Hash map based, bst based and finally trie based.

Last updated