DIS_Quiz5 Flashcards
The most efficient technique for finding nth Fibonacci number is recursion.
False
We generally use best case running time to measure time complexity T.
False
STL algorithms operate only on vectors.
False
If T(n) = 2n + 100n10 + 1000n5 + 10000, then T(n) is O(n10).
False
If T(n) = n3 + 1000n2log2n + 10000, then T(n) is O(n3)
True
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)?
15
The time complexity of binary search is O(log(n)).
True
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)?
6
Recursion is a method of solving a problem where the solution depends on solutions to smaller instances of the same problem
True
If you have a vector of integers v, accumulate(v.begin(),v.end(),0) returns the sum of the elements in the vector.
True