Page 18 - DCAP407_DATA_STRUCTURE
P. 18

Unit 1:  Introduction to Data Structures



               3.   Multidimensional  Array:  Multidimensional arrays can be defined as array of arrays.
                    Multidimensional arrays are not bounded to two indices or two dimensions. They can include as
                    many indices as required.
               Linked List
               A linked list is a data structure in which each data element contains a pointer or link to the next element
               in the list. Through linked list, insertion and deletion of the data element is possible at all places of a
               linear list. Also in linked list, it is not necessary to have the data elements stored in consecutive
               locations. It allocates space for each data item in  its  own block of memory. Thus, a linked list is
               considered as a chain of data elements or records called nodes. Each node in the list contains
               information field and a pointer field. The information field contains the actual data and the pointer field
               contains address of the subsequent nodes in the list.


                                                Figure 1.3: A Linked List

















               Figure 1.3 represents a linked list with 4 nodes. Each node has two parts. The left part in the node
               represents the information part which contains  an entire record of data  items and the right part
               represents the pointer to the next node. The pointer of the last node contains a null pointer.
               Stacks
               A stack is an ordered list in which data items are inserted and deleted only from one end. It is also
               known as Last-In First-Out list (LIFO) because the last element which enters the stack will be on top of
               the stack and is the first one to come out.


                                                  Figure 1.4: A Stack
























               Figure 1.4 is a schematic diagram of a stack. Here, element FF is the top of the stack and element AA is
               the bottom of the stack. Elements are added to the stack from the top. Since it follows LIFO pattern, EE



                                        LOVELY PROFESSIONAL UNIVERSITY                           11
   13   14   15   16   17   18   19   20   21   22   23