Search⌘ K

Cheat Sheet

Explore key worst case time complexities of common data structures and algorithms in this cheat sheet. Learn how operations like insert, retrieve, and traversal perform in arrays, linked lists, trees, and sorting methods to enhance your ability to evaluate algorithm efficiency.

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