ABSTRACT DATA TYPE:
An abstract data type, sometimes abbreviated ADT, is a logical description of how we view the data and the operations that are allowed without regard to how they will be implemented. This means that we are concerned only with what data is representing and not with how it will eventually be constructed. By providing this level of abstraction, we are creating an encapsulation around the data. The idea is that by encapsulating the details of the implementation, we are hiding them from the user’s view. This is called information hiding. The implementation of an abstract data type, often referred to as a data structure, will require that we provide a physical view of the data using some collection of programming constructs and primitive data types.
ALGORITHMS:
Structure and Properties of Algorithm:
An algorithm has the following structure
- Input Step
- Assignment Step
- Decision Step
- Repetitive Step
- Output Step
An algorithm is endowed with the following properties:
- Finiteness: An algorithm must terminate after a finite number of steps.
- Definiteness: The steps of the algorithm must be precisely defined or unambiguously specified.
- Generality: An algorithm must be generic enough to solve all problems of a particular class.
- Effectiveness: the operations of the algorithm must be basic enough to be put down on pencil and paper. They should not be too complex to warrant writing another algorithm for the operation.
- Input-Output: The algorithm must have certain initial and precise inputs, and outputs that may be generated both at its intermediate and final steps.
DIFFERENT APPROACHES TO DESIGN AN ALGORITHM:
An algorithm does not enforce a language or mode for its expression but only demands adherence to its properties.
PRACTICAL ALGORITHM DESIGN ISSUES:
- To save time (Time Complexity): A program that runs faster is a better program.
- To save space (Space Complexity): A program that saves space over a competing program is considerable desirable.
Efficiency of Algorithms:
The performances of algorithms can be measured on the scales of time and space. The performance of a program is the amount of computer memory and time needed to run a program. We use two approaches to determine the performance of a program. One is analytical and the other is experimental. In performance analysis we use analytical methods, while in performance measurement we conduct experiments.
Time Complexity: The time complexity of an algorithm or a program is a function of the running time of the algorithm or a program. In other words, it is the amount of computer time it needs to run to completion.
Space Complexity: The space complexity of an algorithm or program is a function of the space needed by the algorithm or program to run to completion.
The time complexity of an algorithm can be computed either by an empirical or theoretical approach. The empirical or posteriori testing approach calls for implementing the complete algorithms and executing them on a computer for various instances of the problem. The time taken by the execution of the programs for various instances of the problem are noted and compared. The algorithm whose implementation yields the least time is considered as the best among the candidate algorithmic solutions.
PRESENTED BY:- Subhasmita Pattnaik (Lecturer in Computer sc.)