Data Structures19 sections · 729 units
Open in Course

Quiz: Frequency Counting

Time complexity

Check Your Understanding

To count frequency of each element in an array of n elements, what is the time complexity using a hash map?

  1. A.O(n²) - need to compare each pair
  2. B.O(n log n) - need to sort first
  3. C.O(n) - one pass through the array
  4. D.O(1) - constant time
Start the roadmap to answer the quizzes and solve the challenges