Difference between hashset and treeset?



Difference between hashset and treeset?..

Answer / Kumari Arunima

HashSet uses a hash table for storage, allowing constant-time average performance for basic operations. TreeSet uses a red-black tree, ensuring that the elements are sorted in ascending order (by default). HashSet allows null elements while TreeSet does not.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

What is the non linear data structure?

1 Answers  


Differentiate between list and map.

1 Answers  


Is radix sort faster than quicksort?

1 Answers  


In rdbms, explain what is the efficient data structure used in the internal storage representation?

1 Answers  


What is the need for priority queue?

1 Answers  


A list is ordered from smaller to largest when a sort is called. Which sort would take the longest time to execute?

12 Answers  


Define dynamic data structures?

1 Answers  


How does a treemap sort?

1 Answers  


How to reverse a singly linked list?

1 Answers  


How do we search a specific element in an array?

1 Answers  


Which programming language is best for data structures?

1 Answers  


Explain how is linked list implemented?

1 Answers   BPL,


Categories