Let's look at two widely used linear data structures, stacks and queues.

In the stack, data is inserted and extracted only at one end, and in the queues data is inserted at the bottom and extracted from the front, as in the rows of supermarket cashiers, and that nobody can "sneak in" through the middle...

The operations that are used in the stacks are named Pop (extract) and Push (insert) and in the queues insert (Enqueue) and Extract (Dequeue). In general, they can be called Insert and Extract, since in some languages Stack.Extract or Queue.Insert could be written, which if a correct convention is followed when Naming variables should not lead to confusion. However, it is more common to use Pop and Push for stack operations.

To continue reading please click here.



Pin It

No thoughts on “05. Reusing code. Fifth part.”

Leave your comment

In reply to Some User