![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Jan 2008
Posts: 9
Rep Power: 0
![]() |
The Story...
First post, so hoping to be clear and concise, but might end up wordy since it's pretty late at night. I've got a parser that has time data along with some additional information contained within a number of logs. I'm creating a summary report of each log, based on information I parse out. One thing I do is determine the time difference between one item and the next, and want to print in this summary the highest five time differences (time difference and time data, as well as another field). What I'm thinking... Initially I thought I could use a 2-d Array and check the lowest number first (so $array[4]), and if it's less than that, continue on, if not then check the next element in the array until I find the element that it's less than. At that point I have to loop from the beginning again, shifting all elements down, and then copying the data appropriately. Another idea was to continually add to the list, then sort every once in a while and just remove all but the top elements (this was something that would be easy to implement, but probably excessively CPU/memory intensive, as I go through about 10-12 thousand lines in each log). I had some other thoughts on Hashes and Linked Lists, but really not sure what the best solution would be. Am I heading in the right direction (so just code as I stated), or is there something easier (or possibly even already implemented...) Thanks in advanced. |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|