Crafting Elegant Code With Stacks And Queues


Exercises for Chapter #8 of A Common-Sense Guide To Data Structures and Algorithms

Get The Book!

Chapter Exercises


Exercise #1

Describe the steps that occur when we add the numbers 5, 3, 9, 2, 8 to a stack and then remove each number from the stack.

Exercise #2

Describe the steps that occur when we add the numbers 5, 3, 9, 2, 8 to a queue and then remove each number from the queue.

Exercise #3

In your favorite programming language, use a stack to implement an algorithm that reverses a string.

Let's Get In Touch!


Join the forum on The Pragmatic Programmers website to join in on the conversation about this book, or email Jay Wengrow, author of the book and this website directly.