Completed 'Building and sorting an array'