Note : NR : Needs revision
-
Q1: implementing hashtable
-
Ans: Open Hashing, Scparate chaining
-
Q2: Why is worst case complexity of hash tables O(n)?
-
Ans: if the hashing function calculates many of the positions in the same spot given the input data (hashing clashes), then the O(1) startsto creep closer to O(N).
-
Q3: array vs linkedlist vs hash map. When would you choose what?
-
Ans: Array, list have order maintaed facilitating looping. Hash map is not ordered. Iteration can be complicated (NR)
-
Q4: Simulation, Random, Seed (IoT project related)
-
Q5: Truely singleton and efficient design in multithreaded scenario.
-
Ans:double null check, ine inside the lock , one outside on the volatile instance, etc) OPTIMISTIC RETRYING
-
Q6: Checked Exceptions v/s unchecked.
-
Q7: TreeMap v/s HashMap