Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Highest/Lowest value in an array.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
CapnChaos




PostPosted: Mon Dec 06, 2010 7:27 pm   Post subject: Highest/Lowest value in an array.

How do you get turing to find the highest value and lowest value in an array?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Dec 06, 2010 7:42 pm   Post subject: RE:Highest/Lowest value in an array.

- Make an assumption about what the highest value is.
- Check if the array contains an element that's higher.
- Repeat until all elements have been checked.

similar approach for the lowest value.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
TerranceN




PostPosted: Mon Dec 06, 2010 8:00 pm   Post subject: RE:Highest/Lowest value in an array.

You don't even have to assume in Turing, you can use maxint and minint.
CapnChaos




PostPosted: Mon Dec 06, 2010 8:05 pm   Post subject: Re: RE:Highest/Lowest value in an array.

Tony @ Mon Dec 06, 2010 7:42 pm wrote:
- Make an assumption about what the highest value is.
- Check if the array contains an element that's higher.
- Repeat until all elements have been checked.

similar approach for the lowest value.


Figured as much. I was just hoping there was some more efficient way.

Oh well, it's done now anyway.

Thank you for the quick reply.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: