Edited the insertion sort to sort in ascending as well as descending order based on the object order