Computer Science Canada Highest/Lowest value in an array. |
Author: | CapnChaos [ 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? |
Author: | Tony [ 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. |
Author: | TerranceN [ 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. |
Author: | CapnChaos [ 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. |