Complexity of reallocating storage (was users command crap)

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Thu Jan 31 05:27:10 AEST 1991


In article <19010 at rpp386.cactus.org> jfh at rpp386.cactus.org (John F Haugh II) writes:
> In article <15325:Jan2903:19:4991 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
> >Any single-pass ``users'' has to either use quadratic time or be a rude
> >abuser of resources. Why not use two passes and be done with it?
> No, it doesn't.  It can get it exactly right the first time and be done
> with it.

No, your solution insists upon allocating space for empty entries in
utmp. If utmp has ten thousand slots and there are only a thousand
people logged in, you're using ten times too much space. Other than that
it's fine.

---Dan



More information about the Comp.lang.c mailing list