I am having the hardest time getting this algorithm written:(adsbygoogle = window.adsbygoogle || []).push({});

Write an algorithm that returns the index of the first occurrence of the largest element in the sequence s1,..., sn. If the sequence is 6.2, 8.9, 4.2, 8.9, the algorithm returns the value 2.

Input: s, n

Output: ??

I'm stumped on this at the moment - Any help would be greatly appreciated.

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Homework Help: Algorithm writing

**Physics Forums | Science Articles, Homework Help, Discussion**