Completed exercise for array function sort