in reply to Re^3: index of the minimum element of the array
in thread index of the minimum element of the array
i guess that $p should keep the minimum value of the array, but the question is how to get its index.my $j = 1; my $p = $s[1]; #values are present starting from 1st index while ($j != $n - 1) { if (($p < $s[$j+1]) || ($p == $s[$j+1])) { }else{ $p = $s[$j+1]; } $j++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: index of the minimum element of the array
by LanX (Saint) on Jan 17, 2014 at 16:06 UTC |