Abstract Data Type
Explore how abstract data types provide a logical view of data and operations from the user's perspective in Go programming. Understand the difference between ADTs and data structures and how to apply this knowledge when designing efficient data storage and processing solutions.
We'll cover the following...
Abstract data type
A logical description of the data and its operations is known as abstract data type (ADT). ADT is known as the user’s point of view of data. ADT is concerned about possible values of data and interfaces exposed by it. The real execution of the data structure is insignificant to ADT.
Example
A consumer has to keep track of specific integers and calculate their averagevalue. This data structure’s ADT would have two functions: adding integers and calculating the mean value.
The ADT for this data structure exposes its interface to the user. The user will know how to use it. But the user will not get involved in its implementation details.
Data structure
Data structures are concrete representations of data described from the perspective of a programmer. The data structure describes how a programmer can process information in memory. Each data structure has its advantages and disadvantages. Depending on the type of query, we choose the most appropriate data structure.
Example
According to the question, we can store data in an array, stack, queue, linked list, and so on. If we want to search an element in an unsorted list, we can use arrays.
In upcoming lessons, we’ll study various data structures and their APIs.