For the following questions, feel free to build intuition by playing around with plotting software of your choice (I used Google to make the figures in the slides, e.g. searching for “plot x and log(x)”).
T/F In terms of asymptotic runtime analysis, an algorithm that performs
operations is better than an algorithm that performs
operations.
T/F An O() algorithm will always finish faster than an O() algorithm.
T/F For sufficiently large values of , an O() algorithm will always finish faster than an O() algorithm.
The information contained in a method specification pertains to (select one):
The method’s interface
The method’s implementation
Some of each
Is the following statement true or false? If it’s false, correct it.
An abstract data type can have multiple interfaces, but only one implementation.
In the next two problems, you’ll be sorting the following array of integers:
[ 1, 4, 8, 2, 6 ]
Sort the above array using insertion sort. How many times did you swap two elements?
Sort the above array using selection sort. How many times did you swap two elements? Don’t count any instances where an element is swapped with itself.