Posted: 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
Tony
Posted: 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.
Posted: 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
Posted: 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.