Courses‎ > ‎AP Computer Science‎ > ‎Konstantinovich‎ > ‎

2018-12-05

posted Dec 5, 2018, 3:01 AM by Konstantinovich Samuel   [ updated Dec 5, 2018, 3:05 AM ]
Git Folder:
MKS21X-Sorts

Classname:
Sorts.java

Note - This will be updated throughout the semester. It will contain several sorting algorithms.
 
Goal: Test your Homework

Classwork:
Verify your sort/Fix your sort.
Anyone that does not have it working should ask people that do have it working for help. 
As an entire class, you can do it!

public static void selectionSort(int [] ary) { }    //Yes there is camel case.
Note: 
This method does not use an ArrayList, it does not copy things into a new array. 
You are writing a sort that is in-place, meaning only enough extra memory for loop variables and swap space. 

(Click this image For Animation)



Use the numbers in the examples and see if it follows same steps: (print the array after each pass. If it doesn't do the same thing, modify your sort. )
(Note that the sorted / unsorted array designation is for clarity of what has been processed. You are in a single array.
Final Example:

Comments