two sort algorithm