2 min read

Abstract data type in data structure

An abstract data type is defined by its behavior from the point of view of a user, of the data, specifically in terms of possible values, possible operations on data of this type, and the behavior of these operations.
Abstract data type in data structure

Abstract Data type (ADT) is a type (or class) for objects whose behaviour is defined by a set of value and a set of operations.

It does not specify how data will be organized in memory and what algorithms will be used for implementing the operations. It is called “abstract” because it gives an implementation-independent view. The process of providing only the essentials and hiding the details is known as abstraction.

https://media.geeksforgeeks.org/wp-content/uploads/20190828194629/ADT.jpg

for example we have been using data types so user only needs to know what a data type can do, but not how it will be implemented. Now we’ll define three ADTs namely List ADT, Stack ADT, Queue ADT.

List ADT

  • The data is generally stored in key sequence in a list which has a head structure consisting of count, pointers and address of compare function needed to compare the data in the list.
https://media.geeksforgeeks.org/wp-content/uploads/20190917225727/ListADTStructure.png

The data node contains the pointer to a data structure and a self-referential pointer which points to the next node in the list.

//List ADT Type Definitions typedef struct node { void *DataPtr; struct node *link; } Node; typedef struct { int count; Node *pos; Node *head; Node *rear; int (*compare) (void *argument1, void *argument2) } LIST;

Read more about stack ADT and Queue ADT..

Abstract Data Types - GeeksforGeeks
A computer science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
https://www.geeksforgeeks.org/abstract-data-types/

#Abstract #DataType #DataStructure #probyto #ProbytoAI

Subscribe and follow us for latest news in Data Science and Machine learning and stay updated!
Facebook: https://facebook.com/probyto
Twitter: https://twitter.com/probyto
LinkedIn: https://linkedin.com/company/probyto
Instagram: https://instagram.com/probyto