Page 21 - DCAP407_DATA_STRUCTURE
P. 21

Data Structure



                                           Complex numbers consists of a real part and an imaginary part and both parts
                                           are represented by real numbers. Different operations like addition, subtraction,
                                           multiplication, and division can be performed on complex numbers. As we do
                                           not have a true data type for complex numbers, we implement them using an
                                           ADT.

                          Thus, ADT can be considered as the mathematical model for data structures that have similar
                          semantics.



                          Did you know?   Applying an ADT means providing one  procedure or function  for every abstract
                                        operation. The ADT instances are illustrated by some concrete data structure that is
                                        manipulated by those procedures, according to the ADT's specifications.
                          1.4.1   Abstract Data Type (ADT) Model
                          As shown in figure 1.8, there are two different parts of the ADT model - functions (public and private)
                          and data structures. Both, the functions and data structures are contained inside an ADT model and are
                          not part of  the application program. Data structures are available to all the ADT functions  when
                          required  and  a function may call any other function to accomplish its task. This shows that data
                          structures and functions are within the scope of each other. Data is entered, accessed, modified  and
                          deleted through the external application programming interface. This interface can access  only  the
                          public functions. Every ADT operation has an algorithm to perform a specific task. The operation name
                          and parameters are available to the application, and they provide the interface to the application.
                          Simple structures are used to implement a program that completely controls a list.


                                                           Figure 1.8: ADT Model








                                                                             ADT

                             Application                       Public Function          Private Functions
                             Program






                                                                Data Structures
                                                                Arrays
                                                                Linked List

                                                                              Record





                                      It is not enough if you just encapsulate the structure in an ADT. It is also necessary that
                                      multiple versions of the structure coexist.








                          14                      LOVELY PROFESSIONAL UNIVERSITY
   16   17   18   19   20   21   22   23   24   25   26