CHAPTER 4

image

Stacks and Queues

In this chapter, we will explain the following:

  • The notion of an abstract data type
  • What a stack is
  • How to implement a stack using an array
  • How to implement a stack using a linked list
  • How to create a header file for use by other programs
  • How to implement a stack for a general data type
  • How to convert an expression from infix to postfix
  • How to evaluate an arithmetic expression
  • What a queue is
  • How to implement a queue using an array
  • How to implement a queue using a linked list

4.1 Abstract Data Types

We are familiar with the notion of declaring variables of a given type (double, say) and then performing operations ...

Get Advanced Topics in Java: Core Concepts in Data Structures 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.