COSC 2436 - Programming Fundamentals III Data Structures
Bob Comer, Professor of Computer Studies
Example Programs
Chapter 13 - Sorting
Description Program Example of a binary merge sort similar to what is described in the textbook.
The textbook describes an external (file-based) sort, while this example describes an internal (array-based) sort.
Note that the sorting algorithms described in this chapter
all follow the convention of sorting the data at indexes 1 through n,
where n is the number of elements in the array.
This example sorts the elements at indexes 0 through n - 1.
The mergesort function calls itself recursively,
dividing the array into smaller and smaller sub-arrays.
The parameters are a pointer to the first element of the sub-array
and the number of elements in the subarray.
Return to Programming Fundamentals III Home Page
Copyright: © 2015 by the Austin Community College
Department of Computer Studies. All rights reserved.
Comments to: Bob Comer
Last updated: May 5, 2015