Finished method for selection sort. Possible bug in bubble sort function.