linear amortized time stack primitives