in reply to Re: Quickest way to get the oldest file
in thread Quickest way to get the oldest file
Not only is this not memory-efficient, it's not speed-efficient either. There's no need to sort the entire list just to find the largest value. A reasonably efficient algorithm will require n*log(n) comparisons. With 50000 elements, the log(n) starts to become non-negligeable.
Other suggestions here that involve walking down the list and noting the largest value are much more efficient both in terms of speed and memory. They require n comparisons and negligeable additional memory. It's a win-win situation.
|
|---|