DIS_Quiz5 Flashcards

1
Q

The most efficient technique for finding nth Fibonacci number is recursion.

A

False

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

We generally use best case running time to measure time complexity T.

A

False

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

STL algorithms operate only on vectors.

A

False

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

If T(n) = 2n + 100n10 + 1000n5 + 10000, then T(n) is O(n10).

A

False

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

If T(n) = n3 + 1000n2log2n + 10000, then T(n) is O(n3)

A

True

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

double f(unsigned n)
{
if(n == 1)
return 1.0;
else
return n + f(n/2);
}

Given the recursive function above, what is the value of f(8)?

A

15

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

The time complexity of binary search is O(log(n)).

A

True

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

unsigned f(unsigned n)
{
if(n == 0)
return 0;
else
return f(n / 10) + n % 10;
}

Given the recursive function above, what is the value of f(312)?

A

6

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

Recursion is a method of solving a problem where the solution depends on solutions to smaller instances of the same problem

A

True

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

If you have a vector of integers v, accumulate(v.begin(),v.end(),0) returns the sum of the elements in the vector.

A

True

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