Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Hi all,
I will try and explain it the last time. So the file have two columns first is postion and second column is the cumulative frequencies within 50 numbers of the postions.

for ex,

109026 3
109027 25
109028 2

became

109026 3
109027 28
109028 30.

So what I have to do is iterate through the postions, which is column 1, get the postions which go increasing and till there is a difference between the current postion and (latter postion + 50) becomes > 50.

for example

109027 28
109028 30
116958 15
116960 35
116961 39
116962 70
116963 72
153087 32

in the above set,
i will start with 109027, then 109028 and then 116958. Here 116958 - (109028 + 50) is greater than 50
so the first line in the output will be

109027 109078 (which is 109028 + 50) 30

the 30 is the value of position 109028.

next step i have to start from 116958 go through 116963 till 153087, since the difference 153087 - (116963 + 50 ) becomes > 50
So i will stop the iteration and output the next line, which is

116958 117013 (which is 116963 + 50) 72

where 72 is the value for 116963

then i will start from 153087, since there no increasing. I have to stop the iteration and out like this

153087 153137 (which is 153087 + 50) 32

This is the problem. I don't know whether i explained it better than last time. I don't have a code, i'm still stuck with how to implement. Hoping for help.

Thank you in advance.
regards,
Deepak


In reply to Re: Sorting the numbers: A little tricky. by oxydeepu
in thread Sorting the numbers: A little tricky. by oxydeepu

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others rifling through the Monastery: (2)
    As of 2014-07-31 05:53 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (245 votes), past polls