Hey FCC campers, need some help with algorithm, thank you in advance.
What is the result of this code :
max := tab[0];
FOR i FROM 0 TO tab.length-1 DO
IF (tab[i]> max) THEN
max := tab[i];
END_IF
END_FOR
Possible answers :
1-find the minimum of the array values
2-find the maximum of the array values
3-none of the above
and also this one :
FOR i FROM 0 TO tab.length/2 DO
temp := tab[i];
tab[i] := tab[tab.length-1-i];
tab[tab.length-1-i] := temp;
END_FOR
Possible answers :
1-give the number of prime numbers in an array
2-reverse the elements within an array