Page 496 - Computer science 868 Class 12
P. 496

13


                                                                           DATA STRUCTURES

















                          Learning Objectives


                      13.1  Stack                                        13.2  Queue
                      13.3  Linked List                                  13.4  Tree




              Data processing involves manipulation of data. The first step to this process is data collection and storage. We have
              already learnt about single and double dimensional arrays which store data in contiguous and adjacent memory
              locations. In this chapter, we will learn other ways of organising data which require less storage.

              Data structure is a systematic way of storing and organising data in a specialised format, and its relationship with all
              associated members.

              A data structure can be classified into two types on the basis of its arrangement of data.
              •  Linear data structure: In this structure, the data elements are arranged contiguously one after the another. The
                 adjacent elements are attached with one another and is traversed linearly. For example, array, stack, queue, etc.
              •  Non-linear data structure: In this arrangement, the data elements are arranged in a hierarchical order representing
                 parent child relationship. For example, tree and graph.
              Classification can also be made according to the size and format as follows:
              •  Static data structure: In this type, the size and format is fixed during declaration. Since, the maximum memory size
                 is always declared, it may remain unutilised in some cases, e.g., array.
              •  Dynamic data structure: In this data structure, we declare an element with an initial size, which can be changed
                 during runtime as per out requirement, e.g., stack, queue, etc. In dynamic data structure, memory management is
                 done more efficiently.
              Let us understand about some important data structures one by one.


                  13.1 STACK
              A stack is a linear data structure which stores data in LIFO (Last In First Out) order. A stack has only one end, i.e., top.
              And thus, insertion and deletion of data take place from the top only.
              Let us see some applications of stack in our everyday life as discussed below.

              When you submit your homework copy to your teacher, the copies are placed on one above the other. The copy
              submitted first is placed at the bottom and the last one is placed at the top.


                494494  Touchpad Computer Science-XII
   491   492   493   494   495   496   497   498   499   500   501