CS3 Big O

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/66

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 6:03 PM on 9/1/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

67 Terms

1
New cards

Big O notation

An assessment of an algorithm's efficiency that helps gauge the amount of work taking place.

2
New cards

O(1)

Constant

3
New cards

O(log N)

Logarithmic

4
New cards

O(N)

Linear

5
New cards

O(N log N)

Linearithmic

6
New cards

O(N^2)

Quadratic

7
New cards

O(2^N)

Exponential

8
New cards

Constant O(1) Example

int x = 9;

9
New cards

Logarithmic O(log N) Example

Binary search

10
New cards

Linear O(N) Example

A normal, everyday loop that is iterative in nature

11
New cards

Linearithmic O(N log N) Example

A nested for loop containing a linear loop and a logarithmic loop, such as merge sort and quick sort

12
New cards

Quadratic O(N^2) Example

A nested loop with a linear outer and inner loop, such as selection sort and insertion sort

13
New cards

Exponential O(2^N) Example

Stooge sort (randomizing the array and checking if it is sorted repeatedly)

14
New cards

Determining Overall Big O

The most restrictive (slowest) Big O term determines the Big O for the entire section of code.

15
New cards

Array: traversing

O(N)

16
New cards

Array: search for an item

O(N) or O(log N)

17
New cards

Array: remove any item location unknown

O(N)

18
New cards

Array: get any item location unknown

O(1)

19
New cards

Array: add item at the end

O(1)

20
New cards

Array: add item at the front

O(N)

21
New cards

Linked List: traversing

O(N)

22
New cards

Linked List: search for an item

O(N)

23
New cards

Linked List: remove any item location unknown

O(N)

24
New cards

Linked List: get any item location unknown

O(N)

25
New cards

Linked List: add item at the end

O(N)

26
New cards

Linked List: add item at the front

O(1)

27
New cards

Double Linked List: add item at the end

O(1) (All other runtimes are the same as a standard Linked List)

28
New cards

Binary Tree: traversing

O(N)

29
New cards

Binary Tree: search for an item

O(log N)

30
New cards

Binary Tree: remove any item location unknown

O(log N)

31
New cards

Binary Tree: get any item location unknown

O(log N)

32
New cards

Binary Tree: add item at the end

O(log N)

33
New cards

Binary Tree: add item at the front

O(1)

34
New cards

ArrayList: traversing

O(N)

35
New cards

ArrayList: search for an item

O(log N) or O(N)

36
New cards

ArrayList: remove any item location unknown

O(N)

37
New cards

ArrayList: get any item location unknown

O(1)

38
New cards

ArrayList: add item at the end

O(1)

39
New cards

ArrayList: add item at the front

O(N)

40
New cards

Tree Set: add, remove, contains

O(log N)

41
New cards

Tree Map: put, get, containsKey

O(log N)

42
New cards

Hash Set: add, remove, contains

O(1)

43
New cards

Hash Map: put, get, containsKey

O(1)

44
New cards

Linear Search Best Case

O(1)

45
New cards

Linear Search Average Case

O(N)

46
New cards

Linear Search Worst Case

O(N)

47
New cards

Binary Search Best Case

O(1)

48
New cards

Binary Search Average Case

O(log N)

49
New cards

Binary Search Worst Case

O(log N)

50
New cards

Selection Sort Best Case

O(N^2)

51
New cards

Selection Sort Average Case

O(N^2)

52
New cards

Selection Sort Worst Case

O(N^2)

53
New cards

Bubble Sort Best Case

O(N^2)

54
New cards

Bubble Sort Average Case

O(N^2)

55
New cards

Bubble Sort Worst Case

O(N^2)

56
New cards

Insertion Sort Best Case

O(N)

57
New cards

Insertion Sort Average Case

O(N^2)

58
New cards

Insertion Sort Worst Case

O(N^2)

59
New cards

Merge Sort Best Case

O(N log N)

60
New cards

Merge Sort Average Case

O(N log N)

61
New cards

Merge Sort Worst Case

O(N log N)

62
New cards

Quick Sort Best Case

O(N log N)

63
New cards

Quick Sort Average Case

O(N log N)

64
New cards

Quick Sort Worst Case

O(N^2)

65
New cards

Heap Sort Best Case

O(N log N)

66
New cards

Heap Sort Average Case

O(N log N)

67
New cards

Heap Sort Worst Case

O(N log N)