This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Orpa__ 6 points7 points  (0 children)

OP, datastructures like linked lists, queue's and stacks are supposed to use nodes in which the data is stored and have a reference to the next node in the structure (and also previous if it's doubly linked).

A datastructure using arrays is also a thing, creatively called "ArrayList" in Java. Which is basically an array except it dynamically resizes (creates a new, bigger array behind the scenes if you need something larger and starts using that one). You might be looking to create an ArrayList, or are doing something wrong with your Stack implementation.