Getting stuck with some algorithms code ! HELP

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];

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;

Possible answers :
1-give the number of prime numbers in an array
2-reverse the elements within an array

@Shinichi this web service visualizes algorithm executions.

1 Like

Thank you so much !!

1 Like