Explore Library
Data Structures, AlgorithmsComplexity Analysis & Big-O Notation

69 items

1

Finding Duplicates and Big-O

Code Quiz
2

Nested Loop Time & Space Complexity

Quiz
3

Off-by-One in Duplicate Check

Code Quiz
4

Big-O of a Simple Loop

Quiz
5

Big-O Notation Basics

Slides / Video
6

Big-O Notation Basics

Flashcard
7

Big-O for Time and Space

Slides / Video
8

Big-O Time & Space Basics

Flashcard
9

Linearithmic Time O(n log n)

Flashcard
10

Big-Omega Notation

Flashcard
11

Exponential Time O(2^n)

Quiz
12

Ordering Complexity Classes

Quiz
13

Counting Basic Operations

Quiz
14

Dropping Constants

Quiz
15

Dropping Lower-Order Terms

Quiz
16

Complexity of a Single Loop

Quiz
17

Complexity of Nested Loops

Quiz
18

Input Size Drives Complexity

Quiz
19

How Runtime Scales

Quiz
20

Sequential Code Blocks

Quiz
21

Constant Time O(1)

Quiz
22

Logarithmic Time O(log n)

Quiz
23

Linear Time O(n)

Quiz
24

Quadratic Time O(n^2)

Quiz
25

Linearithmic Time O(n log n)

Quiz
26

What Complexity Analysis Is and Why It Matters

Slides / Video
27

Using Complexity to Compare Algorithms

Slides / Video
28

Best, Average, and Worst Case

Slides / Video
29

Space Complexity Basics

Slides / Video
30

Analyzing Nested Loops for Time Complexity

Slides / Video
31

Analyzing Simple Loops for Time Complexity

Slides / Video
32

Dropping Constants and Lower-Order Terms

Slides / Video
33

Ranking Common Complexity Classes

Slides / Video
34

Loop With Doubling Step

Code Quiz
35

Nested Loops Quadratic Time

Code Quiz
36

Single Loop Linear Time

Code Quiz
37

Constant Time Array Access

Code Quiz
38

Ordering Growth Rates

Code Quiz
39

Halving Loop Logarithmic Time

Code Quiz
40

Sort Then Loop Complexity

Code Quiz
41

Dropping Constants In Big-O

Code Quiz
42

Summing Sequential Loops

Code Quiz
43

Two Input Variables

Code Quiz
44

Space Complexity Of Copy

Code Quiz
45

Worst Case Of Linear Search

Code Quiz
46

Common Big-O Complexity Classes

Slides / Video
47

Big-O as an Upper Bound

Slides / Video
48

Definition and Intuition of Big-O Notation

Slides / Video
49

Complexity of Single Loops

Flashcard
50

Comparing Growth Rates

Flashcard
51

Sequential Statements (Addition)

Flashcard
52

Linear Time O(n)

Flashcard
53

Counting Operations

Flashcard
54

Exponential Time O(2^n)

Flashcard
55

Constant Time O(1)

Flashcard
56

Logarithmic Time O(log n)

Flashcard
57

Big-Theta Notation

Flashcard
58

Dropping Constants in Big-O

Flashcard
59

Best, Average, and Worst Case

Flashcard
60

Factorial Time O(n!)

Flashcard
61

Auxiliary Space vs Total Space

Flashcard
62

Complexity of Nested Loops

Flashcard
63

Dropping Lower-Order Terms

Flashcard
64

Quadratic Time O(n^2)

Flashcard
65

Why We Focus on Worst Case

Flashcard
66

Big-O Formal Notation and Meaning

Flashcard
67

How Runtime Grows as Input Grows

Slides / Video
68

Input Size n: The Basis of Analysis

Slides / Video
69

Counting Operations to Estimate Cost

Slides / Video
Code Quiz

Finding Duplicates and Big-O

Spot the bug that quietly turns an intended O(n) duplicate check into O(n squared).

Codejavascript
// Goal: return true if array has any duplicate, in O(n) time and O(n) space
function hasDuplicate(arr) {
  const seen = [];
  for (let i = 0; i < arr.length; i++) {
    if (seen.includes(arr[i])) {
      return true;
    }
    seen.push(arr[i]);
  }
  return false;
}

The function returns correct results, but fails its stated O(n) time requirement. What is the bug?