{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Sorting and Searching

# Sorting and Searching - Sorting and Searching Dr David...

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

Sorting and Searching Dr. David Gaitros Department of Computer Science

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

View Full Document
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);

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

View Full Document
// *********************************************************************** // 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 . // Go through the list until no exchanges are made.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 9

Sorting and Searching - Sorting and Searching Dr David...

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

View Full Document
Ask a homework question - tutors are online