I have following structure
$data = { 1990 => [ 1,2,3], 1991 => [2,3,5], 1992 => [1,2,7,9], .... };
Assume that keys are 'years' and lists are id for some items. I like to find local max, ie.. I can select years from 1990..1999 and want to find out, which are the 10 most popular items in that window for given year. I like to have the results in strip fashion for first k items. So output should look like 'year'X 'item' where each entry in table tells me if item is popular in that year or not. Further sorting to represent minimum gaps at the top would be nice too. For example: Years( 1995..1999). The last column represents the counts in given year.
ItemID  1995    1996    1997    1998    1999
20      =       =       =       =       =               5
5               =       =       =       =               4
6       =               =       =       =               4
7       =               =       =       =               4
12      =       =       =               =               4
14      =       =       =       =                       4
4       =       =               =                       3
9       =       =                       =               3
10      =               =       =                       3
16              =       =               =               3
1               =       =                               2
2       =               =                               2
3       =                               =               2
8               =                       =               2
11                              =       =               2
13      =                       =                       2
17              =       =                               2
19              =                       =               2
15                              =                       1
18                              =                       1
This is not home work, and I have already written some code. I like to know, if there are any modules available..to achieve what I am looking for.

Thanks,

--Artist

In reply to Windows Maximums by artist

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.