HELLO GREAT MINDS OF THE WORLD.....AM studying computer science and algorithms is a new concept to me....I have written an algorithm which returns a smallest value in an array and am not that sure if its correct....
1 s = A[1]
2 for i = 2 to lengthA[] do
3 if s > A then
4 s = A
5 return s
please analysis that and please help me by showing me how i can do an algorithm that output the largest and second largest values in an array A[ 1.....n] assuming n>1 and the values in the array are distinct .