Study sort algorithm