7. Algorithms Flashcards

1
Q

A(n) ____ is a sequence of steps that solves a problem, generating correct output for any valid input values.

A

algorithm

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

A(n) ____ problem specifies an input, a question about the input that can be answered using a computer, and the desired output.

A

computational

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

An efficient algorithm is one whose runtime increases no more than ____ with respect to the input size.

A

polynomially

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

____ problems are a set of problems for which no known efficient algorithm exists.

A

NP-complete

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

One of the three characteristics of an NP-complete problem is that no ____ algorithm has been found to solve an NP-complete problem.

A

efficient

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

One of the three characteristics of an NP-complete problem is that no one has proven that an efficient algorithm to solve an NP-complete problem is ____.

A

impossible

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

One of the three characteristics of an NP-complete problem is that if an efficient algorithm exists for one NP-complete problem, then ____ NP-complete problems can be solved efficiently.

A

all

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

____ is the amount of resources used by an algorithm.

A

Computational complexity

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

An algorithm’s computational complexity includes ____ and ____.

A

runtime, memory usage

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

An algorithm’s ____ is the scenario where the algorithm does the minimum possible number of operations. An algorithm’s ____ is the scenario where the algorithm does the maximum possible number of operations.

A

best case, worst case

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

Complexity analysis always treats the input data size as a(n) ____.

A

variable

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

An algorithm’s ____ complexity is a function, S(N), that represents the number of fixed-size memory units used by the algorithm for an input of size N.

A

space

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

An algorithm’s ____ space complexity is the space complexity not including the input data.

A

auxiliary

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

____ is a search algorithm that starts from the beginning of a list, and checks each element until the search key is found or the end of the list is reached.

A

Linear search

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

An algorithm’s ____ is the time the algorithm takes to execute.

A

runtime

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

Binary search is a faster algorithm for searching a list if the list’s elements are ____ and ____ accessible (such as an array).

A

sorted, directly

17
Q

For an N element list, the maximum number of steps required to reduce the search space to an empty sublist using binary search is ____.

A

(log base 2 of N) + 1

18
Q

Compared to a linear search, binary search is incredibly efficient in finding an element within a(n) ____ list.

A

sorted

19
Q

A(n) ____ is a technique that willingly accepts a non-optimal or less accurate solution in order to improve execution speed.

A

heuristic

20
Q

An example of a problem that a heuristic algorithm can solve is the ____ problem.

A

0-1 knapsack problem

“0-1” means that 0 or 1 of each item can be taken.

For this problem a heuristic algorithm would always take the most valuable item that fits in the knapsack’s remaining space.