My code for different types of sorting