Implement perm sort and merge sort algorithms