Computer Science: An Overview: Global Edition (12th Edition)

Published by Pearson Higher Education
ISBN 10: 1292061162
ISBN 13: 978-1-29206-116-0

Chapter 8 - Data Abstractions - Section 8.1 - Basic Data Structures - Questions & Exercises - Page 377: 3

Answer

The letters on the stack from top to bottom would be E, D, B, and A. If a letter were popped off the stack, it would be the letter E

Work Step by Step

A is pushed onto an empty stack, followed by the letters B and C, in that order. Then suppose that a letter is popped off the stack and the letters D and E are pushed on. List the letters that would be on the stack in the order they would appear from top to bottom. If a letter is popped off the stack: The letters on the stack from top to bottom would be E, D, B, and A. If a letter were popped off the stack, it would be the letter E.
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.