This is part 2 of Big O for Noobs, if you’d like to read part 1, you can do so here.

In the last post, we concluded that the time complexity for the operations performed on an array were:

Read — O(1)

Insertion — O(n) — worst case, O(1) — best case if inserted at the end

Search — O(n)

Deletion — O(n) — worst case, O(1) — best case if deleted from the end

When we apply the same logic to hashes, we will get:

Read — O(1)

Insertion — O(1)

Search — O(n)

Deletion — O (1)

#algorithms #time-complexity #data-structures #javascript #big-o-notation

Big O for Noobs
3.90 GEEK