Page 140 - DCAP201_FUNDAMENTALS_OF_DATA_STRUCTURES
P. 140

Kanika Sharma, Lovely Professional University                                            Unit 9: Stacks





                                       Unit 9: Stacks                                           Notes


             CONTENTS
             Objectives
             Introduction

             9.1  Concept of Stacks
             9.2  Operations on Stacks
                 9.2.1   Implementation of Push Operation

                 9.2.2   Implementation of Pop Operation
             9.3  Representation of Stacks
                 9.3.1   Sequential Representation of Stacks
                 9.3.2   Linked List Representation of Stacks
             9.4  Multi Stacks

             9.5  Application of Stacks
                 9.5.1   Parenthesis Checker
                 9.5.2   Evaluation of Arithmetic Expressions

             9.6  Summary
             9.7  Keywords
             9.8  Review Questions
             9.9  Further Readings

          Objectives

          After studying this unit, you will be able to:

               Discuss the concept of stacks
               Explain sequential and linked list representation of stacks

               Describe operations on stack
               Discuss multi stacks
               Discuss applications of stack

          Introduction

          A stack is a data structure that is used to store elements but all the elements can be inserted or
          deleted from the TOP of the stack. The top of the stack is the top most part of the stack, something
          like a rectangular box which has only opening at the top. A stack is a linear data structure. It is
          very useful in many applications of computer science. A stack is generally implemented with
          two basic operations – push and pop. Push means to insert an item on to stack. The pop operation
          removes the topmost item from the stack. In this unit, we will discuss the concept of stacks. Also
          we will discuss the applications of stacks.





                                           LOVELY PROFESSIONAL UNIVERSITY                                   133
   135   136   137   138   139   140   141   142   143   144   145