[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sc-devel] maxIndex and minIndex?



It works but it's inefficient, because it could require as many as
a.size*2 iterations if the max or min item is last in the array (where
Click's version maxes out at a.size iterations).
hjh

On Dec 27, 2007 11:39 AM, Josh Parmenter <josh@xxxxxxxxxxxxxxxxx> wrote:
> would something like this work?
>
> a  = [0, 3, 2, 5, 8, 3, 9, 6, 5]
>
> a.indexOf(a.maxItem)
> a.indexOf(a.minItem)


-- 
James Harkins /// dewdrop world
jamshark70@xxxxxxxxxxxxxxxxx
http://www.dewdrop-world.net

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman