Ive been trying to write a pseudo code function to recusively look for the smallest item in an array, but how do I set up a variable to hold the smallest element, without reseting it
Smallset(A, j, k) // A = array, j - first element, k - last element
{
(test to see if empty)
(if so exit)
smallest = ? // dont know what to set this too
if(k < smallest)
k == smallest;
else
Smallest(A, j+1, k)
return smallest
}
Didnt know where to post this.
Do you see the problem, it will just clober it if I set it to 0.