Comprehensive Big O Notation and Data Structure Algorithms Review

0.0(0)
studied byStudied by 2 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/37

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.

38 Terms

1
New cards

What is Big O Notation?

It describes how runtime or space grows as input size increases.

2
New cards

What is the Big O of a loop that runs n times?

O(n)

3
New cards

What is the Big O of nested loops each running n times?

O(n²)

4
New cards

What is the Big O of binary search?

O(log n)

5
New cards

What are quicksort's average and worst case complexities?

Average: O(n log n), Worst: O(n²)

6
New cards

What is merge sort's space complexity?

O(n)

7
New cards

Order from best to worst efficiency: O(1), O(log n), O(n), O(n log n), O(n²), O(2^n), O(n!)

O(1) < O(log n) < O(n) < O(n log n) < O(n²) < O(2^n) < O(n!)

8
New cards

Access by index in an array

O(1)

9
New cards

Insert/remove from middle of an array

O(n)

10
New cards

Access nth element in a linked list

O(n)

11
New cards

Insert/delete at head of linked list

O(1)

12
New cards

Advantage of linked list over array

Dynamic size and easy insertion/deletion

13
New cards

Stack push/pop/peek time complexity

O(1)

14
New cards

Queue enqueue/dequeue time complexity

O(1)

15
New cards

Average insert/delete/lookup in hash table

O(1)

16
New cards

Worst case hash table operations

O(n)

17
New cards

What is a hash collision?

When two keys hash to the same index

18
New cards

Search in a balanced BST

O(log n)

19
New cards

Search in an unbalanced BST

O(n)

20
New cards

Traverse a binary tree

O(n)

21
New cards

DFS uses what data structure?

Stack or recursion

22
New cards

BFS uses what data structure?

Queue

23
New cards

Insert into a binary heap

O(log n)

24
New cards

Extract-min or extract-max from a heap

O(log n)

25
New cards

Find-min in a min-heap

O(1)

26
New cards

BFS or DFS time complexity on graph

O(V + E)

27
New cards

Dijkstra's Algorithm complexity

O((V + E) log V)

28
New cards

What is the "Two Pointers" pattern?

Using two indices to optimize array/string traversal

29
New cards

What is the "Sliding Window" pattern?

Maintaining a window for subarray/subsequence analysis

30
New cards

What is "Divide and Conquer"?

Divide problem into subproblems, solve recursively, combine results

31
New cards

What is "Dynamic Programming"?

Storing subproblem results to avoid recomputation

32
New cards

Binary Search time and space complexity

Time: O(log n), Space: O(1)

33
New cards

Merge Sort time and space complexity

Time: O(n log n), Space: O(n)

34
New cards

Quick Sort average and worst case

Avg O(n log n), Worst O(n²)

35
New cards

Iterative BFS uses what data structure?

Queue

36
New cards

Iterative DFS uses what data structure?

Stack

37
New cards

Graph traversal using adjacency list complexity

O(V + E)

38
New cards

How to detect cycle in linked list?

Use two pointers (fast and slow); if they meet, a cycle exists.

Explore top flashcards

AMSCO: Quiz 3
Updated 244d ago
flashcards Flashcards (246)
Germany
Updated 917d ago
flashcards Flashcards (222)
Vivaldi
Updated 1041d ago
flashcards Flashcards (182)
English vocab
Updated 218d ago
flashcards Flashcards (40)
Stages 20-22 vocab
Updated 377d ago
flashcards Flashcards (78)
Circuits
Updated 590d ago
flashcards Flashcards (84)
AMSCO: Quiz 3
Updated 244d ago
flashcards Flashcards (246)
Germany
Updated 917d ago
flashcards Flashcards (222)
Vivaldi
Updated 1041d ago
flashcards Flashcards (182)
English vocab
Updated 218d ago
flashcards Flashcards (40)
Stages 20-22 vocab
Updated 377d ago
flashcards Flashcards (78)
Circuits
Updated 590d ago
flashcards Flashcards (84)