[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Offtopic: How to Design Programming Tests
> > compare the advantages and disadvantages of arrays
> > versus linked lists.
Noel Welsh:
> This is a good question. My answer would be:
> - random access time O(1) vs O(n)
> - queue/stack operations O(n) vs O(1)
> - memory usage: array better
> Anything I missed?
iteration: forward - lists slightly better, backwards - depends on the list :)
(is there actually any CPU which is faster or equally fast on indexed array
access than linked list iteration? assuming typical good languages and
compilers)