Docsity

Sort Checking Project for Computer Science II, Fall 2008 - Prof. Thomas A. Bailey, Study Guides, Projects, Research of Computer Science

Toggle sidebar
bg1
CoSc 2030 printed 1 December 2020
Computer Science II
Fall 2008 page 1 of 2
Programming Project 5
Due Friday, 17 October 2008
Sort Checking Project
Code-R-Us wants to document the correctness and timing of its most used sort routine,
the Standard Template Library sort. Your task is to create data sets of various sizes,
determine the time required to sort the data, and check that the result is sorted. The sort
routine will be timed using three initial data conditions: in order, random order, and
reverse order.
Write a C++ program that
1. gets a data set size, n, from cin,
2. fills three vectors with doubles in order, randomly ordered doubles, and doubles
in reverse order,
3. checks the vectors to see if they are sorted,
4. uses the Standard Template Library sort routine to sort the vectors into ascending
order, and
5. checks the results to see if they are sorted.
For each initial order, report
1. the data set size,
2. the time required to fill the vector,
3. whether or not the vector is sorted before the sort routine is called and the time
required for this check,
4. the time required to sort the data,
5. whether or not the result is sorted after the sort routine is called and the time
required for this check.
Use the high resolution timer class in hrTimer to time code segments.
Turn In
Turn in a printed report that includes:
1. A title page with
CoSc 2030
Program 5
Sort Checking Project
<your name>
<the due date>
pf2

Partial preview of the text

Download Sort Checking Project for Computer Science II, Fall 2008 - Prof. Thomas A. Bailey and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

CoSc 2030 printed 1 December 2020 Computer Science II Fall 2008 page 1 of 2 Programming Project 5 Due Friday, 17 October 2008 Sort Checking Project Code-R-Us wants to document the correctness and timing of its most used sort routine, the Standard Template Library sort. Your task is to create data sets of various sizes, determine the time required to sort the data, and check that the result is sorted. The sort routine will be timed using three initial data conditions: in order, random order, and reverse order. Write a C++ program that

  1. gets a data set size, n, from cin,
  2. fills three vectors with doubles in order, randomly ordered doubles, and doubles in reverse order,
  3. checks the vectors to see if they are sorted,
  4. uses the Standard Template Library sort routine to sort the vectors into ascending order, and
  5. checks the results to see if they are sorted. For each initial order, report
  6. the data set size,
  7. the time required to fill the vector,
  8. whether or not the vector is sorted before the sort routine is called and the time required for this check,
  9. the time required to sort the data,
  10. whether or not the result is sorted after the sort routine is called and the time required for this check. Use the high resolution timer class in hrTimer to time code segments. Turn In Turn in a printed report that includes:
  11. A title page with CoSc 2030 Program 5 Sort Checking Project

CoSc 2030 printed 1 December 2020 Computer Science II Fall 2008 page 2 of 2 in large font at the top of the page and a statement of help delivered and help received at the bottom of the page.

  1. Printouts of test runs for five different data set sizes.
  2. Spreadsheet graphs that demonstrate the time complexity of the STL sort routine and the time complexity of the sort checking code.
  3. A one to two page essay explaining the spreadsheet graphs. [Use 12 point font, double spacing, and one inch margins.] Please use spell checking and grammar checking, both computer and human, on your report Upload Upload your source code to one of your class folders. I will print the code from your upload folder. I may attempt to compile and run your uploaded code.