Page 8 - Data Struct
P. 8

8
                   Algorithm and Data Structure


                   Differences Between Static and Dynamic


                    Static                             Dynamic

                     •  Static data structure causes    •  Linear data structure can be
                         under utilization of              implemented either through
                         memory.                           static or dynamic data
                     •  Static data structure may          structures.
                         cause overflow.                •  Dynamic data structures
                     •  No re-usability of allocated       provides flexibility in adding,
                         memory.                           deleting or rearranging data
                     •  Difficult to guess the exact       objects at run time.
                         size of data at the time of    •  Additional space can be
                         writing of program.               allocated at run time.
                                                        •  Unwanted space can be
                                                           released at run time.


                   Differences Between Linear and Non Linear

                    Linear                          Non-Linear

                     •  organize their data         •  data elements are not organized
                         elements in a linear           in a sequential fashion
                         fashion, where data        •  A data item in a nonlinear data
                         elements are attached          structure could be attached to
                         one after the other            several other data elements to
                     •  Data elements in a liner        reflect a special relationship
                         data structure are             among them and all the data
                         traversed one after the        items cannot be traversed in a
                         other and only one             single run
                         element can be directly    •  Data structures like
                         reached while                  multidimensional arrays, trees
                         traversing.                    and graphs are some examples of
                     •  Linear data structures          widely used nonlinear data
                         are very easy to               structures.
                         implement.                 •   A multidimensional array is
                     •  Some commonly used              simply a collection of one-
                         linear data structures         dimensional arrays
                         are arrays, linked lists,
                         stacks and queues
   3   4   5   6   7   8   9   10   11   12   13