What is the time complexity of Map.prototype.get
if properties of map are objects?
const o1 = {v: 1};
const o2 = {v: 2};
const m = new Map();
m.set(o1, 'o1');
m.set(o2, 'o2');
m.get(o1) // Time complexity O(1)?
m.get(o2) // Time complexity O(1)?
What is the time complexity of Map.prototype.get
if properties of map are objects?
const o1 = {v: 1};
const o2 = {v: 2};
const m = new Map();
m.set(o1, 'o1');
m.set(o2, 'o2');
m.get(o1) // Time complexity O(1)?
m.get(o2) // Time complexity O(1)?
Suppose n is the number of elements in the map, the average time complexity of finding an element is O(log(n)).