Analysis And Design Of Algorithms Flashcards

1
Q

What is the ‘Time Complexity’?

A

Comparing how much time is needed to solve a particular problem of an algorithm

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

How do you compare the efficiency of algorithms in terms of execution time?

A

You quantify the number of basic operations or steps that the algorithm will need, in terms of items to be processed

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

How can the magnitude, or time complexity, of an algorithm be expressed?

A

As a function of its size

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

How is a linear function generally expressed?

A

f(x) = ax + c

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

How is a polynomial function generally expressed?

A

f(x) - ax^m + bx + c

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

In a polynomial function what is the value that will have the major effect?

A

ax^m

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

How is an exponential function generally expressed?

A

f(x) = ab^x

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

How is a logarithmic function generally expressed?

A

f(x) = a log-n x

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

Rank each function from quickest to slowest interim of time to complete an algorithm?

A

Logarithmic, linear, polynomial, exponential

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

What is the permutation of a set of objects?

A

The number of ways of arranging the objects

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

What is Big-O notation used to express?

A

The time complexity of, or performance, of an algorithm

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

What does O(1) describe an algorithm?

A

That an algorithm take constant time to execute regardless of the size of the input data set

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

What does O(n) describe an algorithm?

A

That an algorithm whose performance will grow in linear time, in direct proportion to the size of the data set

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

What does O(1) describe an algorithm?

A

That an algorithm whose performance is directly proportional to the square of the size of the data set, the running time grows in polynomial time

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

What will a program with two nested loops each performed n times will have a time complexity of?

A

O(n^2)

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

What does O(2^n) describe an algorithm?

A

That an algorithm where the time taken to execute will double with every additional item added to the data set, the execution time grows in exponential time

17
Q

What does O(log n) describe an algorithm?

A

That an algorithm time taken to executive an algorithm will grow very slowly as the size of the data set increases

18
Q

How do you calculate the time complexity of the algorithm in Big-O notation?

A

You need to count the number of basic operations it performs