Uploaded by Allen Tran

Quiz 1 Study Guide (Mod 1-2)

advertisement
Here are some study questions to help you apply the learnings from each module. These should
be used in addition to the textbook readings to check your understanding of key concepts &
terminology.
If you can comfortably answer these questions, you should be in good shape for your timed
assessments.
If you get stuck on any questions, or find an error, please let me know!
Quiz 1: Modules 1-2
Module 1 - Complexity Analysis:





What is the difference between time complexity and space complexity?
Experimental analysis is one way to compare algorithms: what are its downsides? How
else can we compare algorithms?
Given code or pseudocode, what is the process to calculate the number of
operations?
o Look up a method you’ve written that includes at least one loop (or search for
code or pseudocode in the text or online): calculate its worst-case number of
operations.
How do we translate the actual time/number of operations into a growth rate?
What will run more efficiently for large inputs:
o an algorithm with a linear growth rate, or an algorithm with a logarithmic growth
rate?
o an algorithm with a constant growth rate, or an algorithm with a linear growth
rate?
o an algorithm with o(n ) growth rate, or an algorithm with O(n log n) growth rate?
o an algorithm with exponential growth rate, or an algorithm with a factorial
growth rate?
3
Module 2 - Searching & Sorting:




When would we use the Comparable interface? What methods must be implemented?
How do they work?
When would we use the Comparator interface? What methods must be implemented?
How do they work?
What is binary search? Does it perform any better or worse than linear search?
How does each of these sorting algorithms work?
o Insertion
o Selection
o Bubble
o Merge
o Quicksort
Download