Sorting algorithm implementations