Wednesday, 3 February 2021

Hashmaps and Time Complexity

  • My understanding is ES6 Map object can implement a Hashmap in Javascript. Is that correct?
  • indexOf method in arrays has an O(n) time complexity.
  • Does has method in Maps have O(1) time complexity? If yes why? How JS can find an element in a Map object in one step? How it works differently than indexOf? If not having an O(1) then Es6 Map is not a real Hashmap...


from Hashmaps and Time Complexity

No comments:

Post a Comment