MergeSort with a twist - Scheme
Hello there,
I would like to implement MergeSort numbers given in a list, but following the following algorithm: 1) break the given list into list of lists, with a single number in each list (i.e. from (5 2 6) to ((5) (2) (6))) 2) iterate over the list of lists - merge each 2 adjacent lists and create a list of the results (example: from ((5) (2) (7) (1)) to ((5 2) (7 1)) or from ((5) (2) (7)) to ((5 2) (7))) 3) repeat step 2 until there is only one element in the list, which is the sorted list. 4) return it. here's my suggestion code, what's wrong with it :(? Code:
(define (fasterMergeSort lst) Thanks in advance |
All times are GMT -4. The time now is 13:54. |