Cheat Sheet

This is a compilation of worst-case complexities for various data-structures and algorithms.

We'll cover the following...

Data-Structures

Data StructureWorst Case Complexity Notes
Array
Insert O(1)
Retrieve O(1)
Linked List
Insert at Tail O(n)
Insert at Head O(1)
Retrieve O(n)

Note that if new elements are added at the head of the linkedlist then insert becomes a O(1) operation. ...

Binary Tree
Insert O(n)
Retrieve