Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able...
-
Upload
rebecca-watts -
Category
Documents
-
view
218 -
download
0
Transcript of Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able...
![Page 1: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/1.jpg)
Data Structures: A Pseudocode Approach with C 1
Chapter 3Chapter 3
Objectives
Upon completion you will be able to
• Explain the design, use, and operation of a stack• Implement a stack using a linked list structure• Understand the operation of the stack ADT
StacksStacks
![Page 2: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/2.jpg)
Data Structures: A Pseudocode Approach with C 2
![Page 3: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/3.jpg)
Data Structures: A Pseudocode Approach with C 3
3.1 Basic Stack OperationsThe stack concept is introduced and three basic stack operations are discussed.
3.2 Stack Linked List ImplementationIn this section we present a linked-list design for a stack. After developing the data structures, we write pseudocode algorithms for the stack ADT.
3.3 C Language ImplementationsThis section presents a simple non-ADT implementation of a stack. We develop a simple program that inserts random characters into the stack and then prints them.
3.4 Stack ADTBegins the discussion of the stack ADT with a discussion of the stack structure and its application interface. We then develop the required functions.
![Page 4: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/4.jpg)
Data Structures: A Pseudocode Approach with C 4
3-1 Basic Stack Operations
The stack concept is introduced and three basic stack The stack concept is introduced and three basic stack operations are discussed.operations are discussed.
• Push• Pop• Stack Top
![Page 5: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/5.jpg)
Data Structures: A Pseudocode Approach with C 5
![Page 6: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/6.jpg)
Data Structures: A Pseudocode Approach with C 6
![Page 7: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/7.jpg)
Data Structures: A Pseudocode Approach with C 7
![Page 8: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/8.jpg)
Data Structures: A Pseudocode Approach with C 8
![Page 9: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/9.jpg)
Data Structures: A Pseudocode Approach with C 9
3-2 Stack Linked List Implementation
In this section we present a linked-list design for a In this section we present a linked-list design for a stack. After developing the data structures, we write stack. After developing the data structures, we write pseudocode algorithms for the stack ADT.pseudocode algorithms for the stack ADT.
• Data Structure• Algorithms
![Page 10: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/10.jpg)
Data Structures: A Pseudocode Approach with C 10
![Page 11: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/11.jpg)
Data Structures: A Pseudocode Approach with C 11
![Page 12: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/12.jpg)
Data Structures: A Pseudocode Approach with C 12
![Page 13: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/13.jpg)
Data Structures: A Pseudocode Approach with C 13
![Page 14: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/14.jpg)
Data Structures: A Pseudocode Approach with C 14
![Page 15: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/15.jpg)
Data Structures: A Pseudocode Approach with C 15
![Page 16: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/16.jpg)
Data Structures: A Pseudocode Approach with C 16
![Page 17: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/17.jpg)
Data Structures: A Pseudocode Approach with C 17
![Page 18: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/18.jpg)
Data Structures: A Pseudocode Approach with C 18
![Page 19: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/19.jpg)
Data Structures: A Pseudocode Approach with C 19
![Page 20: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/20.jpg)
Data Structures: A Pseudocode Approach with C 20
![Page 21: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/21.jpg)
Data Structures: A Pseudocode Approach with C 21
![Page 22: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/22.jpg)
Data Structures: A Pseudocode Approach with C 22
![Page 23: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/23.jpg)
Data Structures: A Pseudocode Approach with C 23
![Page 24: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/24.jpg)
Data Structures: A Pseudocode Approach with C 24
3-3 C Language Implementations
This section presents a simple non-ADT implementation This section presents a simple non-ADT implementation of a stack. We develop a simple program that inserts of a stack. We develop a simple program that inserts random characters into the stack and then prints them.random characters into the stack and then prints them.
![Page 25: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/25.jpg)
Data Structures: A Pseudocode Approach with C 25
![Page 26: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/26.jpg)
Data Structures: A Pseudocode Approach with C 26
![Page 27: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/27.jpg)
Data Structures: A Pseudocode Approach with C 27
![Page 28: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/28.jpg)
Data Structures: A Pseudocode Approach with C 28
![Page 29: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/29.jpg)
Data Structures: A Pseudocode Approach with C 29
![Page 30: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/30.jpg)
Data Structures: A Pseudocode Approach with C 30
![Page 31: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/31.jpg)
Data Structures: A Pseudocode Approach with C 31
3-4 Stack ADT
We begin the discussion of the stack ADT with a We begin the discussion of the stack ADT with a discussion of the stack structure and its application discussion of the stack structure and its application interface. We then develop the required functions. interface. We then develop the required functions.
• Data Structure• ADT Implemenation
![Page 32: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/32.jpg)
Data Structures: A Pseudocode Approach with C 32
![Page 33: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/33.jpg)
Data Structures: A Pseudocode Approach with C 33
![Page 34: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/34.jpg)
Data Structures: A Pseudocode Approach with C 34
![Page 35: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/35.jpg)
Data Structures: A Pseudocode Approach with C 35
![Page 36: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/36.jpg)
Data Structures: A Pseudocode Approach with C 36
![Page 37: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/37.jpg)
Data Structures: A Pseudocode Approach with C 37
![Page 38: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/38.jpg)
Data Structures: A Pseudocode Approach with C 38
![Page 39: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/39.jpg)
Data Structures: A Pseudocode Approach with C 39
![Page 40: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/40.jpg)
Data Structures: A Pseudocode Approach with C 40
![Page 41: Data Structures: A Pseudocode Approach with C1 Chapter 3 Objectives Upon completion you will be able to Explain the design, use, and operation of a stack.](https://reader036.fdocuments.in/reader036/viewer/2022062516/56649da65503460f94a91f53/html5/thumbnails/41.jpg)
Data Structures: A Pseudocode Approach with C 41