Prerequisite: Abstract Data Types or ADT
Why Abstract Data Type became a necessity?
- Earlier if a programmer wanted to read a file, the whole code was written to read the physical file device. So that is how Abstract Data Type (ADT) came into existence.
- The code to read a file was written and placed in a library and made available for everyone’s use. This concept of ADT is being used in the modern languages nowadays.
The code to read the keyboard is an ADT. It has a data structure, a character, and a set of operations that can be used to read that data structure.
- ADT does the work that is necessary implementation and it is not of much concern that how the work is being done. It is like unspecified implementation which can be termed as Abstraction.
- Consider we want maintain a record of quantity of items sold in a sale. At least three possibilities of data structure are there. One can use a linear list or an array or may be a vector to save space and dynamic memory allocation or a linked list so that there is no missing item. A user does not need to know the hidden implementation as long as the data is being entered and obtained correctly.
- For definition refer to Abstract Data Types
Abstract Data Type Model
There is an interface between Application Program and the Abstract Data Type present at the right. ADT consists of the data structures and the functions(private and public) which are interconnected with each other. Since they are entirely present in the ADT so they are out of the scope of the Application Program.
- ADT Data Structure
- All data that is being processed is maintained in a data structure and its implementation must not to be known to the user.
- At the same time all the data about the structure should be present inside the ADT because just encapsulating the data in ADT is not sufficient.
- ADT operations
- Data is inserted, deleted and updated through the application program via the interface. The functions that are publicly declared are directly accessible otherwise not since only the parameter name and number of such parameters is available to the users.
- There is a particular algorithm for every Abstract Data Type for a specific task to be performed.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.