Define the cost of an algorithm.
True or false: Different implementations of the same algorithm
can lead to different efficiency measures.
True or false: Different platforms running the same algorithm
always take the same amount of time.
True or false: If an algorithm is run on two very different
platforms, it may have a different
True or false: the data structure a programmer uses in an
algorithm can have an effect on an algorithm's efficiency.
Define the real running time of an algorithm.
The efficiency and complexity of an algorithm are measured in
____ because it allows for easy comparisons of similar
If a function required
3 +12(nlogn) + 2n
steps to run, what would its big-O notation be?
If a function required
5/n + 12/n
3 + 100/(nlogn)
run, what would its big-O notation be?
The process of determining the rate of growth of a function is
True or false:
O(nlogn) < = O(nloglogn)
True or false: If
n > m
m) < = O(m
is referred to as:
True or false: When comparing two functions, we focus on the
limit of the function as
Word processors often have a "find" function that allows you to
search for a word in your text. If the application uses the
data as is (i.e. doesn't put it into any sort of new data
structure), what search algorithm or structure does it most
True or false: linear search requires a data set to be sorted.
True or false: Given
pieces of data, the best we can do to
search it is
True or false: Searching is an important topic in computer
science, and new algorithms for it are being devised all the
True or false: Linked lists are often searched with a modified
binary search method.
True or false: Most people look up a name in a phonebook with a
modified linear search algorithm
True or false: The mailman finds your house using a binary
Binary search requires data to be in what order?
True or false: Linked lists allow for random access.
True or false: Arrays allow for random access.
True or false: When doing a linear search, every element in the
array or list is always examined.
True or false: When doing a binary search, every element in the
array or tree is examined.
True or false: A doubly-linked list would allow for random
access whereas a singly-linked list wouldn't.
If you were going to implement a spell checker, which of the
following structures might you allocate to hold the words best?
A reversible function is one where for
h(x) = y
-1(y) = x
. True or false: a hash function is always a reversible
A deletion operation when using linear probing to handle
True or false: A hash function can only have one input.
True or false: A hash function usually returns a non-negative
Which of the following rules does NOT make for a good hash function?
True or false: Brute-force string searching and Rabin-Karp
string searching are the only known ways to look for a string
within another string.
True or false: Binary search would not be considered a
brute-force searching method.
True or false: Rabin-Karp works because two strings can never
hash to the same value.
True or false: Fingerprinting is a method that often uses hash
True or false: There are cases where Rabin-Karp string searching is
actually worse than brute-force string searching.
In modular arithemetic,
(amodb + c)modb
, is the same as:
True or false: Rabin-Karp string search is always
O(M + N)
Using knowledge you have to throw away a portion of your data
set while continuing to search the rest is a technique used in:
Given the following hash function:
int hash(char* str)
int sum = 0;
while (*str != '\0') sum += (int) *str++;
return sum % 1;
the strings "This is a great SparkNote." and "I can't believe
I've been wasting my time with textbooks." both hash to the
A algorithm that is
could run slower than which of the
True or false: A linked list would also be a good way to store
a hash table.
True or false: The ideas behind a hash table require that the data
structure used have random access capabilities.
When thoroughly reading this SparkNote, the method you use for
going through it most closely resembles which search?
True or false: A binary search requires a binary search
tree as the data structure being search.
A hash table lookup on a well implemented hash table using separate
chainging can result in which of the following access efficiencies?
True or false: After reading this guide, you're now an expert
on basic searching methods.