Data Structures Final Big-O

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/31

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

32 Terms

1
New cards

ArrayList | add(index, val) / remove(index)

Best-case: O(1), Worst-case: O(n)

2
New cards

ArrayList | add(val) at end (amortized)

Best-case: O(1), Worst-case: O(1)

3
New cards

ArrayList | get(index) / set(index, val)

Best-case: O(1), Worst-case: O(1)

4
New cards

ArrayList | contains(val)

Best-case: O(1), Worst-case: O(n)

5
New cards

LinkedList (Singly/Doubly) | add/remove at head or tail

Best-case: O(1), Worst-case: O(1)

6
New cards

LinkedList (Singly/Doubly) | add/remove/search at index

Best-case: O(1), Worst-case: O(n)

7
New cards

LinkedList (Singly/Doubly) | get(index)

Best-case: O(1), Worst-case: O(n)

8
New cards

Stack (array or linked list) | push, pop, peek, isEmpty

Best-case: O(1), Worst-case: O(1)

9
New cards

Queue | enqueue, dequeue, peek

Best-case: O(1), Worst-case: O(1)

10
New cards

Deque | add/remove at both ends

Best-case: O(1), Worst-case: O(1)

11
New cards

BST (unbalanced) | insert, delete, contains

Best-case: O(log n), Worst-case: O(n)

12
New cards

AVL Tree | insert, delete (with rotations)

Best-case: O(log n), Worst-case: O(log n)

13
New cards

AVL Tree | contains, findMin, findMax

Best-case: O(log n), Worst-case: O(log n)

14
New cards

Tree Traversals | in-order, pre-order, post-order

Best-case: O(n), Worst-case: O(n)

15
New cards

Expression Tree Evaluation | build & evaluate from postfix

Best-case: O(n), Worst-case: O(n)

16
New cards

Hash Table - Chaining | insert, delete, contains

Best-case: O(1), Worst-case: O(n)

17
New cards

Hash Table - Chaining | Average-case (with good hash & load factor < 1)

Best-case: O(1), Worst-case: O(1)

18
New cards

Hash Table - Linear Probing | insert, delete, contains

Best-case: O(1), Worst-case: O(n)

19
New cards

Heap (Binary Min/Max Heap) | insert (percolate up)

Best-case: O(1), Worst-case: O(log n)

20
New cards

Heap (Binary Min/Max Heap) | deleteMin / deleteMax (percolate down)

Best-case: O(log n), Worst-case: O(log n)

21
New cards

Heap (Binary Min/Max Heap) | buildHeap (array)

Best-case: O(n), Worst-case: O(n)

22
New cards

Heap (Binary Min/Max Heap) | peek

Best-case: O(1), Worst-case: O(1)

23
New cards

Selection Sort | All operations

Best-case: O(n²), Worst-case: O(n²)

24
New cards

Insertion Sort | All operations

Best-case: O(n), Worst-case: O(n²)

25
New cards

Merge Sort | All operations

Best-case: O(n log n), Worst-case: O(n log n)

26
New cards

Quick Sort | All operations (median-of-three)

Best-case: O(n log n), Worst-case: O(n²)

27
New cards

Heap Sort | All operations

Best-case: O(n log n), Worst-case: O(n log n)

28
New cards

Dijkstra's (w/ Min Heap) | Full run

Best-case: O((V + E) log V), Worst-case: O((V + E) log V)

29
New cards

Topological Sort | DFS or in-degree queue

Best-case: O(V + E), Worst-case: O(V + E)

30
New cards

Kruskal's (with union-find) | Full run

Best-case: O(E log E), Worst-case: O(E log E)

31
New cards

Prim's (w/ min-heap) | Full run

Best-case: O((V + E) log V), Worst-case: O((V + E) log V)

32
New cards

Hash Table Quadratic Probing 'insert, delete, contains"

Best-case: O(1), Worst-case: O(n)