A stack is a data structure that consists of Nodes. Each Node references the next Node in the stack, but does not reference its previous.
First, you should have the Node that you want to add. Here is an example of a Node that we want to add to the stack
Next, you need to assign the next property of new node to reference the same Node that top is referencing: old node
Technically at this point, your new Node is added to your stack, but there is no indication that it is the first Node in the stack.
a queue is a collection of entities that are maintained in a sequence and can be modified by the addition of entities at one end of the sequence and the removal of entities from the other end of the sequence