Assignment 2 : Due Monday, February 26 (extended)

General Rules:


1. Please hand in only your own work.
2. Grades discounted 10% per day late.

Actual Task:


Your job is to write the mergesort function in ML.

  
Mergesort recursively breaks a single list down
into equal size parts, sorts each of the parts,
then merges the sorted lists back into a single
list.  Note that since singleton and empty lists
are already sorted, the base case is completely
trivial.
You will have three key tasks to complete this function:

1) write the main function
2) write the "merge" function
3) write functions which grab (roughly-subject to rounding) equal size parts of the list
There are at least two simple ways to deal with task 3:

a) the length function is predefined, work down the list saving (or trashing) half the elements by count

b) work down the list and save every other number (just start with the first number for one function, the second for the other).

See that wasn't so hard, was it?