Sale!

EECS2500 Project 2, Running Times solution

$30.00 $25.50

Category:

Description

5/5 - (7 votes)

1. (20 points) Big_OH Notation Consider the following functions:
n+sin(n) 4n
2
log3n 3
n
20n 2 log2 n n2/3
(a) Arrange the six expressions by asymptotic growth rate from slowest to fastest.
(b) Graph the following six functions on a single plot varying n from 1 to 10.
n+sin(n) 4n
2
log3n 3
n
2 n
2/3
2. (50 points) Sorting Create 3 text files, one with the 50000 integers 1 through
50000 in order, one with the 50000 integers 1 through 50000 in reverse order, and one
with 50000 random integers (between 1 and 50000). Write a program to
Read the name of a file
Store the contents of the file into a 50000 element array,
Sort the array using an Insertion Sort, and
Print the actual running time (without any server overhead) of the sort.
Print the number of comparisons used in the sort.
Print just the first 30 values in the resulting array
Turn in a printed copy of the program, along with a printout of the output from three
separate runs (using the three text files).
Extra Credit (20 points) Implement the Bag class for a bag of integers as described in the file
Chap02 Bag Class.ppt
posted in the folder Lecture Notes on the class website. Also create a driver class similar to that for
the Die class above to show that the Bag class works.