CHAPTER 7
QUEUES AND STACKS
This chapter introduces you to queues and stacks that were briefly introduced in Chapter 4 in the section pertaining to linear data structures.
The first part of this chapter explains the concept of a queue, along with Java code samples that show you how to perform various operations on a queue. Some of the code samples also contain built-in functions for queues, such as isEmpty(), isFull(), push(), and dequeue().
The second part of this chapter explains the concept of a stack, along with Java code samples that show you how to perform various operations on a stack. In addition, you will see code samples for finding the largest and smallest elements in a stack and reversing the contents of a stack.
The final section ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access