Differentiate between hashmap and treemap.



Differentiate between hashmap and treemap...

Answer / Reeshoo Kumar Mishra

HashMap is a data structure that stores key-value pairs where keys are unique, unordered, and can be any type of object. It uses a hash function to map the keys to an array index. On the other hand, TreeMap is also a data structure for storing key-value pairs but it organizes its keys in a sorted fashion following a tree structure. This makes TreeMap useful when you need to maintain an ordered collection.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

What is adt example?

1 Answers  


Briefly explain recursive algorithm 50 how do you search for a target key in a linked list?

1 Answers  


Can arraylist store primitives?

1 Answers  


What is list and its types?

1 Answers  


Mention some drawbacks of the linked list.

1 Answers  


Why do we need searching algorithms?

1 Answers  


What is difference between hashset and treeset?

1 Answers  


How does a hashtable work?

1 Answers  


Can we add or delete an element after assigning an array?

1 Answers  


What is tree in computer science?

1 Answers  


Which list does not allow duplicates?

1 Answers  


How to find the missing element in integer array of 1 to 7?

1 Answers  


Categories