How does the Stack data type work?

A Stack is an abstract data type (ADT), this means its a concept rather than an implementation. I will explain the Stack ADT using the idea of a pile of plates. The pile is the Stack.

With a pile of plates you can only do 2 things:

  1. Put a single plate on top of the plates already on the pile, or
  2. Remove a single plate from the top of the pile.

These 2 actions have specific names. You PUSH a plate onto the top of the pile and POP a plate of the top of the pile.

A Stack can be implemented using a LinkedList where the last element in the LinkedList is the element on top of the pile. When you POP from the stack the element that was below it becomes the new element at the top, i.e the plate second from the top in the pile of plates.

SO
Answered by Sam O. Computing tutor

1394 Views

See similar Computing A Level tutors

Related Computing A Level answers

All answers ▸

How can the idea of precondtioning as part of 'Thinking Ahead' benefit a programmer when writing code?


Why are bit patterns often displayed in hexadecimal notation instead of binary notation?


Outline the differences between how a compiler and an interpreter works, and explain the advantages and usage of of each [12 marks]


What is an ALU?


We're here to help

contact us iconContact usWhatsapp logoMessage us on Whatsapptelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo

© MyTutorWeb Ltd 2013–2025

Terms & Conditions|Privacy Policy
Cookie Preferences