The numbers in the output below were randomly generated. The numbers you get will be different. That's fine.

The sample output only shows trace level 1. Your code should work with any trace level, showing the appropriate level of detail. You don't need to do anything to make that happen except don't break the code that's already there!

Return to assignment description

Sample Output

General Sorting =============== Choose a sorting method from the options below. 0: Quit 1: Bubble Sort 2: SelectionSort 3: Insertion Sort 4: Shell Sort Choice: 1 Enter a trace level: 0 - no tracing 1 - outer loop only 2 - inner loop as well Trace level: 1 Initial array: 422 555 746 788 602 882 801 451 709 913 ...press enter... One more bubbled up ... ... ... ... ... ... ... ... ... 913 ...press enter... One more bubbled up ... ... ... ... ... ... ... ... 882 913 ...press enter... One more bubbled up ... ... ... ... ... ... ... 801 882 913 ...press enter... One more bubbled up ... ... ... ... ... ... 788 801 882 913 ...press enter... One more bubbled up ... ... ... ... ... 746 788 801 882 913 ...press enter... One more bubbled up ... ... ... ... 709 746 788 801 882 913 ...press enter... One more bubbled up ... ... ... 602 709 746 788 801 882 913 ...press enter... One more bubbled up ... ... 555 602 709 746 788 801 882 913 ...press enter... One more bubbled up ... 451 555 602 709 746 788 801 882 913 ...press enter... Array now sorted 422 451 555 602 709 746 788 801 882 913 ...press enter... 0: Quit 1: Bubble Sort 2: SelectionSort 3: Insertion Sort 4: Shell Sort Choice: 2 Enter a trace level: 0 - no tracing 1 - outer loop only 2 - inner loop as well Trace level: 1 Initial array: Twas brillig and the slithy toves did gyre and gimble in the wabe ...press enter... one more selected: Twas ... ... ... ... ... ... ... ... ... ... ... ... ...press enter... one more selected: Twas and ... ... ... ... ... ... ... ... ... ... ... ...press enter... one more selected: Twas and and ... ... ... ... ... ... ... ... ... ... ...press enter... one more selected: Twas and and brillig ... ... ... ... ... ... ... ... ... ...press enter... one more selected: Twas and and brillig did ... ... ... ... ... ... ... ... ...press enter... one more selected: Twas and and brillig did gimble ... ... ... ... ... ... ... ...press enter... one more selected: Twas and and brillig did gimble gyre ... ... ... ... ... ... ...press enter... one more selected: Twas and and brillig did gimble gyre in ... ... ... ... ... ...press enter... one more selected: Twas and and brillig did gimble gyre in slithy ... ... ... ... ...press enter... one more selected: Twas and and brillig did gimble gyre in slithy the ... ... ... ...press enter... one more selected: Twas and and brillig did gimble gyre in slithy the the ... ... ...press enter... one more selected: Twas and and brillig did gimble gyre in slithy the the toves ... ...press enter... Array now sorted Twas and and brillig did gimble gyre in slithy the the toves wabe ...press enter... 0: Quit 1: Bubble Sort 2: SelectionSort 3: Insertion Sort 4: Shell Sort Choice: 3 Enter a trace level: 0 - no tracing 1 - outer loop only 2 - inner loop as well Trace level: 1 Initial array: Bob Brian John Cathy Mark David Loretta Alex ...press enter... one more inserted: Bob Brian ... ... ... ... ... ... ...press enter... one more inserted: Bob Brian John ... ... ... ... ... ...press enter... one more inserted: Bob Brian Cathy John ... ... ... ... ...press enter... one more inserted: Bob Brian Cathy John Mark ... ... ... ...press enter... one more inserted: Bob Brian Cathy David John Mark ... ... ...press enter... one more inserted: Bob Brian Cathy David John Loretta Mark ... ...press enter... one more inserted: Alex Bob Brian Cathy David John Loretta Mark ...press enter... Array now sorted Alex Bob Brian Cathy David John Loretta Mark ...press enter... 0: Quit 1: Bubble Sort 2: SelectionSort 3: Insertion Sort 4: Shell Sort Choice: 4 Enter a trace level: 0 - no tracing 1 - outer loop only (n-sorted) 2 - middle loop, too (inserted) 3 - innermost loop (inserting) Trace level: 1 Initial array: Bob (A00000001)Brian (A00000002)John (A00000003)Cathy (A00000004)Mark (A00000005)David (A00000006)Loretta (A00000007)Alex (A00000008) ...press enter... now 5-sorted ...offset 0 Bob (A00000001) ... ... ... ...David (A00000006) ... ... ...offset 1 ...Brian (A00000002) ... ... ... ...Loretta (A00000007) ... ...offset 2 ... ...Alex (A00000008) ... ... ... ...John (A00000003) ...offset 3 ... ... ...Cathy (A00000004) ... ... ... ... ...offset 4 ... ... ... ...Mark (A00000005) ... ... ... ...press enter... now 3-sorted ...offset 0 Bob (A00000001) ... ...Cathy (A00000004) ... ...Loretta (A00000007) ... ...offset 1 ...Brian (A00000002) ... ...John (A00000003) ... ...Mark (A00000005) ...offset 2 ... ...Alex (A00000008) ... ...David (A00000006) ... ... ...press enter... now 1-sorted ...offset 0 Alex (A00000008)Bob (A00000001)Brian (A00000002)Cathy (A00000004)David (A00000006)John (A00000003)Loretta (A00000007)Mark (A00000005) ...press enter... Array now sorted Alex (A00000008)Bob (A00000001)Brian (A00000002)Cathy (A00000004)David (A00000006)John (A00000003)Loretta (A00000007)Mark (A00000005) ...press enter... 0: Quit 1: Bubble Sort 2: SelectionSort 3: Insertion Sort 4: Shell Sort Choice: 0

Return to assignment description