![Page 1: Implementations of the ADT Stack Chapter 7 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013](https://reader030.vdocument.in/reader030/viewer/2022032804/56649e4c5503460f94b412b7/html5/thumbnails/1.jpg)
Implementations of the ADT Stack
Chapter 7
Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013
![Page 2: Implementations of the ADT Stack Chapter 7 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013](https://reader030.vdocument.in/reader030/viewer/2022032804/56649e4c5503460f94b412b7/html5/thumbnails/2.jpg)
Contents
• An Array-Based Implementation
• A Link-Based implementation
• Implementations That Use Exceptions
Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013
![Page 3: Implementations of the ADT Stack Chapter 7 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013](https://reader030.vdocument.in/reader030/viewer/2022032804/56649e4c5503460f94b412b7/html5/thumbnails/3.jpg)
An Array Based Implementation
FIGURE 7-1 Using an array to store a stack’s entries: (a) a preliminary sketch; (b) implementation details
Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013
![Page 4: Implementations of the ADT Stack Chapter 7 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013](https://reader030.vdocument.in/reader030/viewer/2022032804/56649e4c5503460f94b412b7/html5/thumbnails/4.jpg)
An Array Based Implementation
• Consider a header file for an array based implementation, Listing 7-1
• View the accompanying implementation file, Listing 7-2
Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013
.htm code listing files must be in the same folder as the .ppt files
for these links to work
.htm code listing files must be in the same folder as the .ppt files
for these links to work
![Page 5: Implementations of the ADT Stack Chapter 7 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013](https://reader030.vdocument.in/reader030/viewer/2022032804/56649e4c5503460f94b412b7/html5/thumbnails/5.jpg)
A Link-Based implementation
FIGURE 7-2 A link-based implementation of a stack
Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013
![Page 6: Implementations of the ADT Stack Chapter 7 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013](https://reader030.vdocument.in/reader030/viewer/2022032804/56649e4c5503460f94b412b7/html5/thumbnails/6.jpg)
A Link-Based implementation
• View header file for an link-based implementation, Listing 7-3
• Note the accompanying implementation file, Listing 7-4
Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013
![Page 7: Implementations of the ADT Stack Chapter 7 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013](https://reader030.vdocument.in/reader030/viewer/2022032804/56649e4c5503460f94b412b7/html5/thumbnails/7.jpg)
Implementations That Use Exceptions
• Note header file for the class PrecondViolatedExcep, Listing 7-5
• View the accompanying implementation file, Listing 7-6
Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013
![Page 8: Implementations of the ADT Stack Chapter 7 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013](https://reader030.vdocument.in/reader030/viewer/2022032804/56649e4c5503460f94b412b7/html5/thumbnails/8.jpg)
End
Chapter 7
Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013