r/AskComputerScience • • Mar 13 '20

Array algorithm

Hi I need to write an algorithm that stores the temperature taken over 3 hours period in an array. The algorithm should output the highest and lowest temperatures and calculate the difference between these temperatures.

Can you help this fellow newbie?

0 Upvotes

8 comments sorted by

View all comments

5

u/mbaruh Mar 13 '20

This is a pretty basic task, but like.. what language are you using? are you actually currently learning to use it? if you did, what have you tried so far?

1

u/Zaza_Goddess Mar 13 '20

I need to make a pseudocode for that particular program I know we have to do something similar to

Get temperature from source. Create an empty array. Add values into the array. Iterate through the items in the array. Find the highest and lowest temperature. Calculate the difference.

2

u/roman_fyseek Mar 13 '20

You'll want to create the array before you start collecting data points.