Tuesday, April 08, 2025

LATEST UPDATES
>> What is the difference between continue and break statement?  >> What is a singleton class? Give a practical example of its usage.  >> What’s the purpose of Static methods and static variables?  >> What are the various access specifiers for Java classes?  >> What is the difference between an Inner Class and a Sub-Class?    

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 Seo Blogger Templates