Analyst Integration Question:
How much time it take to retrieve an element if stored in HashMap, Binary tree and a Linked list? how it change if you have millions of records?
Answer:
In HashMap it takes O(1) time, in binary tree it takes O(logN) where N is number of nodes in tree and in linked list it takes O(n) time where n is number of element in list. Millions of records doesn't affect the performance if data structure are working as expected e.g. HashMap has no or relatively less number of collision or binary tree is balanced. If that's not the case then their performance degrades as number of records grows.
Previous Question | Next Question |
Explain three different kinds of testing that might be performed on an application before it goes live? | What is difference between & and && operator? |