shuffling lines in a stream

BCS ao at pathlink.com
Fri Oct 10 15:36:08 PDT 2008


Reply to Andrei,

> BCS wrote:
> 
>> Reply to Andrei,
>> 
>>> Well I agree things can be coded such that you make the copy only if
>>> the file is too large anyway. But one lseek call per line is a
>>> complete disaster, whether you call it I/O effect or whatnot. I'd go
>>> as far as saying I'd never even try such a solution, especially
>>> since there exists a forward-pass algorithm. Of course measuring
>>> would be a great way to prove me wrong.
>>> 
>>> Andrei
>>> 
>> I think Big-O on mine is n.
>> 
> I disagree. Big-O with lseek under the rug? That's a non-solution
> because it essentially redefines the problem into "if I had a
> random-access operator then this is pretty much like array shuffling".
> If you have a random-access operator there is no problem to think
> about.
> 
> Andrei
> 

In that case this isn't a problem /I/ am intersted in trying to solve.





More information about the Digitalmars-d mailing list