algorithms (asymptotic notation) Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

constant

1st O(1)

A
  • The time complexity remains the same regardless of the number of items.
  • For example finding the first item in the list will always take the same amount of time regardless of the size of the list.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Logarithmic

2nd O(log(n)

A
  • Inverse of exponentiation.
  • The increase in time complexity decreases as the number of items increases.
  • Examples binary search and binary search tree.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

linear

3rd O(n)

A

The time complexity is proportional to the number of items. Linear search is an example of linear complexity as each item has to be evaluated.

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

polynomial

4th O(n^K)

A

K is a constant value.

The rate at which time complexity rises increases as the number of items gets larger. Bubble sort is an example of this due to the nested loops.

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

linearithmic

5th O(n log(n))

A

The product of linear and Logarithmic operation. The execution time grows faster than a linear function but slower than any polynomial.

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

exponential

6th O(k^n)

A

The time complexity increases exponentially as the number of items gets larger. Recursive problems (Fibonacci sequence) if k = 2 the growth will double in size.

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

factorial

7th O(n!)

A

The time complexity increases extremely quickly as the number gets larger. The travelling salesman is an example of this due to the only solution being a brute force search.

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

tractable problem

A

A problem that is solvable by a polynomial-time algorithm
This means it can be solved in a reasonable amount of time
The upper bound (worst-case scenario) is polynomial

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

intractable problem

A

A problem that cannot be solved by a polynomial-time algorithm
This means that, although an algorithm can be written to find the correct answer, it will not be solved in a reasonable amount of time
The lower bound (best-case scenario) is exponential

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

Big O notation

A

-To describe how the time requirements of an algorithm grow in relation to the number of items being processed
-This allows algorithms to be compared in relation to their complexity
Independent of actual hardware
how long an algorithm takes in the worst-case scenario
-An O is used as a prefix for all expressions written in Big-O Notation
n is used to refer to the number of items

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