min max of a list

querypk at gmail.com querypk at gmail.com
Thu May 5 15:40:25 EDT 2005


what if we do something like this. Assume the values list is the
content of a histogram. Then we see that
values = [  0,  72,   0,   4,   9,   2,   0,   0,  42,  26,   0, 282,
23,   0, 101, 0,   0,   0,   0,   0]
 1 is repeated 72 times, 3 -> 4 times and so on. That is the index
would be the value repeated as many times as in the list.
Now If we find the max and look for the adjcent index. FOr example

take 282 :

Index of 282 --> 11
now check for value of index 10 and 12 .If value(10) < value(9) then
there is a dip as value(9) and value(11) are greater than value(10).
that could be the lower bound of that range. then if
value(11) and value(13) for value(12). if value(11)< value(10) there is
a dip. SO the bounds of [10,12] -> [0,282,23]  rather than  [10, 13]
values:  [0, 282, 23, 0] ( in your case).
How would this work. Is there someway I could do this faster.




More information about the Python-list mailing list