SortingandSearching

SortingandSearching - Sorting and Searching Dr. David...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Sorting and Searching Dr. David Gaitros Department of Computer Science Sorting • The arrangement of items in either ascending or descending order. • Requires that two items can be compared and that some aspect or key portion of the items can be compared and that a relationship of less than, greater than, or equal to exists. Example • Let’s say that I have an array defined as below and that it has been loaded with numbers. • The number of items in the array is defined by the variable ArraySize. double LargeArray[MAXSIZE]; int ArraySize; BubbleSort(LargeArray,ArraySize); // *********************************************************************** // Swap to double numbers. Used in the sorting routine twice. // ************************************************************************ void swap(double *num1,double *num2) { double temp = *num1; *num1 = *num2; *num2=temp; } // ************************************************************************ // Bubble Sort ....
View Full Document

This note was uploaded on 04/02/2012 for the course COP 3014 taught by Professor Gaitros during the Fall '11 term at Florida State College.

Page1 / 9

SortingandSearching - Sorting and Searching Dr. David...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online