Download the following app and install it on your phone.
![]() |
Source code: Efficiency.zip |
|---|
The app allows you to create random lists of up to 100 integers ranging in value from 1 to 100.
It then provides two buttons, Sort1 and Sort2. One button uses a quadratic sorting algorithm. The other uses a linear sorting algorithm. Each algorithm reports the amount of time in milliseconds that it takes to sort the list. Your job is to figure out which is which and to document your answer.
Run at least 3 trials for each Sort using lists of size 10, 20, 30, 40, and 50 numbers. Then compute the average number of milliseconds required for each sized list. Your results should be presented in tabular form:
List Size (N) Sort 1 Average Sort 2 Average 10 - - 20 - - 30 - - 40 - - 50 - -
Use the data in your table to back up your conclusion about which sort is which.
Review the lecture notes on Analyzing Algorithms.
For each of the following problems, decide whether it can be solved by a
linear algorithm and explain briefly why or why not.
For each of the following problems, decide whether it can be solved by a
logarithmic algorithm and explain briefly why or why not.
For each of the following problems, decide whether or not it is intractable
and explain briefly why or why not.
Getting Help
The TAs will be available in the evenings to help you with this assignment.