LATEST UPDATES

Friday 18 November 2016

What is the difference between HashSet and TreeSet ?


  • The HashSet is Implemented using a hash table.
  • Its elements are not ordered. 
  • The add, remove, and contains methods of a HashSet.
  • Time  complexity O(1). 



  •  TreeSet is implemented using a tree structure. 
  • The elements in a TreeSet are sorted.
  • The add, remove, and contains methods.
  • Time complexity  O(logn).

No comments:

Post a Comment

Designed By Blogger Templates