-4

Is there a built in implementation of hash table in python which finds the key based on value in O(c) time (c - constant). I guess dictionaries in python finds the key just by iterating through the values.

tural
  • 310
  • 4
  • 17

1 Answers1

2

Python's dict is a hash-table (see this StackOverflow answer)

And from Python wiki:

Python's dictionary implementation reduces the average complexity of dictionary lookups to O(1) by requiring that key objects provide a "hash" function

Community
  • 1
  • 1
justhalf
  • 8,960
  • 3
  • 47
  • 74