Measures an algorithm's ability to handle different inputs.
What is generality?
100
Search algorithm that requires every item in a list to be compared in the worst case scenario.
What is a linear or sequential search algorithm?
100
Every recursion method requires this to work properly.
What is a base case?
100
Two methods for representing or communicating algorithms.
What are pseudocode and flowchart?
200
Measures an algorithm's representation in number of lines of code.
What is compactness?
200
A divide and conquer approach to searching a list.
What is a binary search?
200
The primary characteristic of a recursion method.
What is calls itself?
200
The two programming constructs that implement iterations in high level programming languages.
What is a while loop and a for loop?
300
Measures an algorithm's distance from a specific implementation.
What is abstractness?
300
The data structure that holds a list in a computer.
What is an array?
300
Represents the base case
public int factorial (int n)
{ int product = 1;
if (n>1)
product = n *factorial (n-1);
return product;
}
What is there is no base case?
300
The worst case number of comparison that would need to be made if the man with locked-in syndrome used the binary search algorithm.
What is 5.
400
A way of comparing the performance of different algorithms under best case, worst case, and average case loads.
What is efficiency?
400
The index or address that all computer lists or arrays start with.
What is 0?
400
Return value for somefun(3)
public int someFun(int n)
{
if (n<=0)
return 2;
else
return someFun(n-1) * someFun(n-1);
}
What is 256?
400
The comparisons that will be performed in a binary search that is looking for 8 in the following list.
-216, -125, -64, -27, -8, -1, 0, 1, 8, 27, 64, 125, 216
What is 0, 27, 1, 8 OR 0, 64, 8
500
True or False: It doesn't make sense to talk about the efficiency of an algorithm until it is implemented on a particular computer.
What is False?
500
The worst case number of guesses it would take to find a missing playing card of a particular suit if the cards are in order.
What is 4?
500
The recursive method that calculates n! = 1*2*...*n.
What is fact(int n)
if (n==0)
return 1;
else
product <- fact(n-1) *n;
return product.
500
The pseudocode for calculating 1-2+3-4+...-n.
What is sum(int n)
sum <- 0
sign <- 1
i <- 1
while i is less than or equal to n repeat the following instruction:
sum <- sum + (sign*i);
return sum;