Lesson 4 (MIDTERM) Flashcards

(19 cards)

1
Q

Is the most common way to express time complexity.

A

Big O Notation

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

It describes the worst-case scenario for an algorithm, giving an upper bound on its running time. This helps you predict how the algorithm will perform on a large dataset

A

Big O Notation

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

What are the most common Big O notations?

A

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

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

The number of operations is constant and doesn’t depend on the size of the input

A

O(1) Constant Time

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

The running time grows very slowly as the input size increases

A

O(log n) Logarithmic Time

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

The running time grows proportionally to the size of the input

A

O(n) Linear Time

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

The running time grows faster than linear but slower than quadratic

A

O(n log n) - Log-Linear Time or Linearithmic Time

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

The running time is proportional to the square of the input size

A

O(n^2) Quadratic Time

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

The running time grows at an incredibly fast rate. This usually seen in algorithms that generate all permutations of a set

A

O(n!) Factorial Time

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

What examples is this, Accessing a single element in an array

A

Constant Time or O(n)

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

What example is this, Binary search

A

O(log n) Logarithmic Time

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

What example is this Traversing an array or a linked list

A

O(n) Linear Time

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

What example is this Efficient sorting algorithms like quicksort and merge sort

A

O(n log n) Linearithmic or Log-Linear Time

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

What example is this Nested loops that iterate over the entire input for each element, such as in bubble sort.

A

O(n^2) Quadratic Time

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

The Travelling Salesman Problem using a brute-force approach

A

O(n!) Factorial Time

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

Why is Complexity Important?

A

Performance Prediction
Algorithm Comparison
Scalability

17
Q

It allows you to predict how an algorithm will behave as the input size grows without needing to run it. This is especially important for large-scale data processing

A

Performance Prediction

18
Q

It provides a standardized way to compare the efficiency of different algorithms designed to solve the same problem. This helps you choose the most optimal one for your use case

A

Algorithm Comparison

19
Q

it helps you assess how well an algorithm will scale. An algorithm with O(n) complexity is much more scalable for large inputs than one with O(n^2) complexity