It is times.
Station a: (sorted)
{Train 0 => 1230, Train 1 => 1244, Train 2 => 1245 , Train 3 => 1247 }
Station b: Train 3 does not stop here, so time is 0000. But I know it is following Train 1.
{Train 1 => 1245, Train 2 => 0000 , Train 3 => 1248 }
I will take the existing order of trains, and calculate the next station.
But trains can be overtaken by other trains in which case I will have a time for the train. So if as station c Train 1 overtakes Train 3 but Train 2 has no time the array would be
{ Train 0 => 1245, Train 1 => 1255, Train 2 => 0000, Train 3 = 1250 }. In that case my sorting needs to set Train 1at the end, while the other trains need to be kept in order.
It is not 5 entries but a couple of 100000s of times that need to be sorted.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.