BigO Notation Flashcards

1
Q

Best scenario for linear search

A

O(1) - constant

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Average scenario for linear search

A

O(n) - linear

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Worst scenario for linear search

A

O(n) - linear

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Best scenario for binary search

A

O(1) - constant

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Average scenario for binary search

A

O(log n) - logarithmic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Worst scenario for binary search

A

O(log n) - logarithmic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Best scenario (time) for bubble sort

A

O(n) - linear

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Average scenario (time) for bubble sort

A

O(n^2) - polynomial

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Worst scenario (time) for bubble sort

A

O(n^2) - polynomial

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Space complexity for bubble sort

A

O(1) - constant

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Best scenario (time) for insertion sort

A

O(n) - linear

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Average scenario (time) for insertion sort

A

O(n^2) - polynomial

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Worst scenario (time) for insertion sort

A

O(n^2) - polynomial

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Space complexity for insertion sort

A

O(1) - constant

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Best scenario (time) for merge sort

A

O(n log n) - linearithmic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Average scenario (time) for merge sort

A

O(n log n) - linearithmic

17
Q

Worst scenario (time) for merge sort

A

O(n log n) - linearithmic

18
Q

Space complexity for merge sort

A

O(n) - linear

19
Q

Best scenario (time) for quick sort

A

O(n log n) - linearithmic

20
Q

Average scenario (time) for quick sort

A

O(n log n) - linaerithmic

21
Q

Worst scenario (time) for quick sort

A

O(n^2) - polynomial

22
Q

Space complexity for quick sort

A

O(log n) - logarithmic

23
Q

Order of bigO

A

CLoLiLinPolE (Constant, Logarithmic, Linear, Linearithmic, Polynomial, Exponential)

24
Q

Explain the bigO notation O(1)

A

Constant complexity. Executes in the same amount of time regardless of data set.

25
Q

Explain the bigO notation O(log n)

A

Logarithmic complexity. Halves the data set in each pass. Efficient with large data sets. The algorithm will take one additional step each time the data (n) doubles. Log n is the inverse of exponential E.g. Binary Search

26
Q

Explain the bigO notation O(n)

A

Linear complexity. Performance is proportional to the size of the data set and increases as the data set grows. E.g. Linear Search

27
Q

Explain the bigO notation O(n log n)

A

Linearithmic. Algorithms that divide a data set but can be solved using concurrency on independent divided lists. E.g. Merge Sort

28
Q

Explain the bigO notation O(n^2)

A

Polynomial complexity. Performance is proportional to the square of the size of the data set. Efficiency is reduced with large data sets. E.g. Bubble Sort, Insertion Sort

29
Q

Explain the bigO notation O(2^n)

A

Exponential complexity. Doubles with each addition to the data set in each pass

30
Q

explain bigO - 3 marks

A

Big O defines the runtime required to execute an algorithm by identifying how the performance of your algorithm will change as the input size grows
Big O = how the algorithm scales with larger data sets
Evaluates the complexity of the algorithm (1)
Shows how the time / memory / resources increase as the data size increases (1)
Evaluates worst case scenario for the algorithm (1)

31
Q
A