Review of parameter passing:
Examples using activation records:
Read the batch of data, unknown count, from the standard input device.
Read the batch of data, unknown count, from an external file.
Iterative Binary Search Algorithm:
While( Able to breakdown the array in two halves)
{
Breakdown by computing the Middle.
If (Searched Value is equal to the Middle value)
then "found" at Middle. Stop.
If (Searched Value is less than the Middle value)
then look in the left sub-half.
else look in the right sub-half.
}Done with While
If you get here, the searched value does not exsists.
Selection Sort Algorithm:
Do the following starting from the first element in the Array moving one element at each iteration.
Find the Smallest. element in the Array.
Swap it with the rightmost element.
Find the index of Smallest Algorithm:
Assume the first element to be the smallest
Visit each element and update the smallest "so far"
Quick Sort Algorithm:
Split the Array by putting the first element in its place.
Quicksort the left sub-array.
Quicksort the right sub-array.
Split Algorithm:
Consider first element to be the Pivot.
Bring all smaller elements elements to the left of the pivot, and larger to the right.
Keep a Right pointer to the rightmost element.
Keep a Left pointer to the leftmost element.
Move the right pointer and stop at the element smaller than the pivot.
Swap the elements.
If the pointer meet, swap the pivot, and the Array is split, return to Quicksort.