implementing stacks using dynamic arrays

Mike Capp mike.capp at gmail.com
Sun Apr 9 09:06:50 PDT 2006


In article <e1b0dn$28vl$1 at digitaldaemon.com>, Boyko Bantchev says...
>
>int[] a;
>int t;
>..
>a ~= t;
>which makes a beautiful generic push operation for stacks.

Maybe beautifully generic, but horrendously inefficient. It gives you linear
complexity for each push, which is really not what you're looking for in a Stack
implementation.

cheers
Mike





More information about the Digitalmars-d mailing list