[WPI] [cs2223] [cs2223 text] [News] [Syllabus] [Problems]
cs2223, D97/98 Problem 1
Go to Solution
Problem Statement
- Write a program which multiplies an n-digit number by 2 and
prints the result. Submit a program listing and printout showing the program
being tested. The test number(s) must be much larger than the size of an
int
on the machine you used. What do think is the order of
the algorithm you used? Include computer printout, obtained using your
program, verifying your conclusion. Include computer printout showing the
result.
- Calculate the best, worst, and average case orders of the insertion
sort. Write a program which sorts a list of the first 1000 integers using
an insertion sort. Keep track of the number of comparisons and verify your
results for the best case, worst case, and the average of 1000 different
random orderings of the integers. Submit a program listing and printout
showing how you obtained your results.
- Arrange these functions of n in their correct order, using the
technique of section 3.2 of the text.
Show the mathematical derivations which led to your conclusions.
Contents ©1994-1998, Norman Wittels
Updated 26Mar98
Updated 11Mar98