Completed code for sorting.rb program