With our covering of sets, algorithms, algorithmic complexity, and efficiency, it makes sense to reinforce those concepts through code. I'd like you to develop the beginnings of a program that will demonstrate various sorting algorithms, starting with your own best attempt implementation, aka the naive sort.
By naive sort, I want you to try your best at implementing a sort based on your current pool of programming and problem solving experience; do NOT look up any of the common established sorting algorithms for this, as it will taint your ability to create a naive sort.
Don't worry, the other sorts will be soon to follow.
Write a program that does the following:
You may develop the program with the following assumptions in mind:
You resulting program should operate in a manner similar to the following (output doesn't have to exactly match):
lab46:~/src/discrete/p04$ ./sortprog Enter a unique value (-1 to quit): 37 Enter a unique value (-1 to quit): 73 Enter a unique value (-1 to quit): 57 Enter a unique value (-1 to quit): 75 Enter a unique value (-1 to quit): 73 Enter a unique value (-1 to quit): 4 Enter a unique value (-1 to quit): 32 Enter a unique value (-1 to quit): 1 Enter a unique value (-1 to quit): -1 Before Sorting: 37, 73, 57, 75, 73, 4, 32, 1 After Sorting: 1, 4, 32, 37, 57, 73, 73, 75 lab46:~/src/discrete/p04$
I will be evaluating your program one-on-one at the start of class, when this is due. If you do not show up, you will not receive credit any for it.
Please be sure your program also meets the following criteria: