Activation Record Instance
Activation Records (call stack) - machine dependent data structures containing subroutine state information. Each stack frame (Activation Record Instance) corresponds to a call to a subroutine w/c has not yet terminated with a return.
Merge Sort - A sort algorithm that splits the items to be sorted into two groups, recursively sorts each group, and merges them into a final, sorted sequence.
/*merge sort algorithm*/
void Merge(int A[], int L, int M, int R)
/* Merge L to M with M+1 to R ranges of A */
end
void MergeSort(int A[], int L, int R)
int M = (L+R)/2
if (L<R)
MergeSort(A, L, M)
MergeSort(A, M+1, R)
Merge(A, L, M, R)
end
end
main
Num[5] = {4, 5, 2}
MergeSort(Num, 0, 2)
end


Post new comment