© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2021
T. MailundIntroduction to Computational Thinkinghttps://doi.org/10.1007/978-1-4842-7077-6_16

16. Stacks and Queues

Thomas Mailund1  
(1)
Aarhus N, Denmark
 

This chapter will explore two additional abstract data structures, stacks and queues. We have already implemented them without our knowledge, so we won’t spend much time on that but instead explore what we can do with them.

The operations we need from a stack are the following:
  • You can push an element onto a stack.

  • You can get the most recent element you pushed.

  • You can pop an element from a stack, which means you remove the most recent element you pushed. Getting and removing the top element on the stack are ...

Get Introduction to Computational Thinking: Problem Solving, Algorithms, Data Structures, and More now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.