Review Questions
1
.
Why did we introduce tree data structures as an alternative to linear data structures?
-
Some complex data can only be represented with a tree data structure.
-
Some simple data can only be represented with a tree data structure.
-
Linear data structures cannot implement sets and maps.
-
Tree data structures are typically more effective at implementing sets and maps.
2
.
How does the graph abstract data type differ from other abstract data types?
-
It can model the relationships between elements.
-
It is more efficient than other abstract data types.
-
It can solve problems that other abstract data types cannot solve.
-
It does not specify a particular data structure implementation.
3
.
What abstract data type do binary heaps most commonly implement?
-
lists
-
sets
-
maps
-
priority queues
4
.
What is one way to describe the relationship between algorithms, problems, and modeling?
-
Algorithms are the foundation for problem models.
-
Algorithms solve a model of a problem.
-
Each algorithm can only be used to solve a single problem.
-
Each problem can only have a single model.
5
.
At what point do computer scientists apply algorithm design patterns?
-
when learning canonical algorithms
-
when modeling a problem
-
when solving new problems
-
when analyzing an algorithm
6
.
How does the model of computation relate to the problem model?
-
The model of computation is synonymous with problem model.
-
Problem models constrain the model of computation.
-
The model of computation constrains the problem modeling process.
-
The model of computation describes a single algorithm for each problem model.
7
.
Why is case analysis important?
-
Case analysis provides an alternative to asymptotic analysis.
-
Case analysis focuses on small inputs.
-
Case analysis simplifies the step-counting by introducing a cost model.
-
Case analysis considers factors other than the size of the problem.
8
.
What is true about the order of growth of binary search with respect to the size of the sorted list?
-
In the best case, the order of growth of binary search is constant.
-
In the best case, the order of growth of binary search is logarithmic.
-
In the worst case, the order of growth of binary search is constant.
-
In the worst case, the order of growth of binary search is linear.
9
.
How does time complexity relate to space complexity?
-
Time complexity measures efficiency according to the size of the problem, while space complexity does not.
-
Both time and space complexity measure the efficiency of algorithms as they relate to the nature of the problem.
-
Time complexity focuses on asymptotic analysis while space complexity focuses on experimental analysis.
-
Both time and space complexity can apply methods from asymptotic analysis and experimental analysis.
10
.
What are the three steps in divide and conquer algorithms?
11
.
Why do many greedy algorithms fail to compute the best solution to a combinatorial problem?
12
.
What are the three steps in reduction algorithms?
13
.
What is quicksort’s algorithm design pattern and algorithmic paradigm?
-
Quicksort is an application of the binary search tree algorithm design pattern and an example of the divide and conquer algorithmic paradigm.
-
Quicksort is an application of the binary search tree algorithm design pattern and an example of the brute-force algorithmic paradigm.
-
Quicksort is an application of the binary search tree algorithm design pattern and an example of the greedy algorithmic paradigm.
-
Quicksort is an application of the binary search tree algorithm design pattern and an example of the randomized incremental construction algorithmic paradigm.
14
.
What graph problems can breadth-first search solve?
-
exponential node tree
-
minimum spanning trees
-
unweighted shortest paths
-
weighted shortest paths
15
.
What is a primary drawback of hashing?
-
There can be collisions as the same element can hash to multiple values.
-
There can be collisions between multiple elements that hash to the same value.
-
Hashing is slower than binary search for search problems.
-
Hashing is faster than binary search for search problems.
16
.
What is the relationship between Turing machines and models of computation?
17
.
What is one of the three key ideas of the Turing machine?
-
infinite memory by virtualization
-
a memory bank for storing data
-
using divide and conquer to always reduce an algorithm to O(n) runtime
-
using divide and conquer to always reduce an algorithm to O(1) runtime
18
.
What is P versus NP?
-
P refers to the polynomial time complexity class, whereas NP refers to the nondeterministic polynomial time complexity class.
-
P refers to any Big O notation past O(N3), whereas NP refers to any Big O notation less than O(N3).
-
NP is a constant runtime, whereas P is polynomial runtime.
-
P refers to constant runtime, whereas NP is linear runtime.