LearnFrenzy
Sign in Take a free test

HashMap and TreeMap · HashMap and TreeMap MCQ · Question 5

Time complexity of HashMap get Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 5 Back to Exercise

What is the average time complexity of get and put in a HashMap?

  • A O(n)
  • B O(1) Correct
  • C O(log n)
  • D O(n log n)
Correct Answer: Option B

TreeMap is O(log n).

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links