MergeSort (Array(First..Last))
Begin
If Array contains only one element Then
Return Array
Else
Middle= ((Last + First)/2) rounded down to the nearest integer
LeftHalfArray = MergeSort(Array(First..Middle))
RightHalfArray = MergeSort(Array(Middle+1..Last))
ResultArray = Merge(LeftHalfArray, RightHalfArray)
Return ResultArray
EndIf
End MergeSort
Definitions
Decomposition
breaking a problem into a number of
sub-problems, so that each sub- problem
accomplishes an identifiable task
Abstraction
the process of removing
unnecessary detail from a
problem
Algorithm
A sequence of instructions to complete a task
in a finite amount of time