4 ms·
I agree linked lists might be suboptimal for a stack implementation, but for a different reason: data locality. You can have O(1) stack with both implementatio
by kroolik 5y ago
I agree linked lists might be suboptimal for a stack implementation, but for a different reason: data locality.
You can have O(1) stack with both implementations. Slice-based will be easier to follow, and will bust the cache less often (less pointer jumps).