On Fri, Nov 30, 2001 at 09:02:47AM +0000, Piers Cawley wrote:
> > That's just not true.  Consider the algorithm:
> >    1) count the lines in the file [don't retain ANY data --- just scan
> >       the file and count lines]
> >    2) rewind, skip N/2 lines, read the next one
> >
> > Which is unequivocally O(1) memory and O(n) time.
> 
> Doesn't it rather depend on the size of the line? Or doesn't that
> affect the big O for memory?

We're not counting that last "read the next one" part in the memory usage.


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl Quality Assurance      <[EMAIL PROTECTED]>         Kwalitee Is Job One
<purl> Hey, Schwern!  THERE IS A HUGE GAZORGANSPLATTEDFARTMONGERING-
LIGHTENINGBEASTASAURSOPOD BEHIND YOU!  RUN, BEFORE IT GAFLUMMOXES YOUR
INNARDLYBITS!

Reply via email to