Finished problem 3.5 (selection sort implementation)