Full-stack dev quiz question #65

Full-stack dev quiz question #65quiz

HashSet is probably the most popular implementation of a set in Java. An important reason of that is computational complexity of crucial operation on HashSet. Check sixty fith question of full-stack dev quiz to find out, if you know what that means.

What computational complexity the contains method has of HashSet?

Choose all valid answers.

  1. O(1)
  2. O(n)
  3. O(n logn)
  4. constant
  5. linear
  6. logarithmic

For the correct answer scroll down













Do not miss valuable content. You will receive a monthly summary email. You can unsubscribe anytime.

















The correct answer is: a,d. If you would like to read more, check Is it worth using HashSet for a few elements? article.

We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.