Lab 06

SORT Sort

 

Objective:

 

I really like the word SORT! SORT SORT SORT SORT!  All SORTS of SORTS! Anyways, I like it so much that I want you to write a program to analyze some strings input from the user, count the number of times SORT (case doesn’t matter) appears in each string, then sort them from least number of SORT’s to most number of SORT’s!

 

Requirements:

 

 

Example Dialog:

*The following Example Dialog demonstrates the interactions between a user and ONE possible implementation of the required software’s front-end / user interface. The software’s front-end / user interface may be implemented in MANY different ways and will receive full credit as long as it meets the most minimal of the above requirements. While you may use the example dialog as a guide, it is strongly encouraged to create the front-end / user interface in your own way. *

Key

Unhighlighted Text

Program’s Output

Highlighted Text

User’s Input

 

Enter any number of strings and I will sort by SORT’s.  Once you’re done entering sentences enter “quit”.

 

Sort

asdf

asdfsort

asdfasdfsortSortSORTsort

sortsortsortsortSORTSORTSORTSORT

qwertqwertqwertqwertsortSORT

sortzilla

quit

sort SORTED!

asdf

Sort

asdfsort

sortzilla

qwertqwertqwertqwertsortSORT

asdfasdfsortSortSORTsort

sortsortsortsortSORTSORTSORTSORT

 

Would you like to sort more Strings?

No

Goodbye!

 

Lab Report Questions:

  1. Create a section named “Problem” and describe this lab’s problem in your own words. (10pts).
  2. Create a section named “Solution Description” and describe how the code solves the problem in your own words. (10pts).
  3. Create a section named “Problems Encountered” and describe the various syntax, run-time, and logic errors that were encountered while implementing the solution. (10pts)
  4. Is f(n) = n, O(n2)? Describe why or why not.
  5. Is f(n) = 2,000n3 + 1,000,000n2 + 200n + 4, O(n3)? Desribe why or why not.
  6. Is f(n) = n!, O(2n)? Describe why or why not.
  7. What is the Big O time complexity for bubble sort?
  8. What is the Big O time complexity for quick sort?
  9. What is the Big O time complexity for merge sort?
  10. In relation to time complexity, which is considered more efficient, Selection Sort or Merge Sort? Describe why.

 

Finally: