2

I know this question has been asked a million times but Can someone please explain to me what ADT exactly means (in layman's terms if possible) ?

I read this definition of ADT- ADT only mentions what operations are to be performed but not how these operations will be implemented. So is the case with primitive data types.

Suppose if we have a float data type, we know that multiplication, division, etc. operations can be performed (so we know what operations will be performed) but we don't how it'll be performed (in case of multiplication we can just multiply or repeatedly add, so we have two processes giving the same result and therefore it's abstract). So both data types are essentially the same. (I know it's incorrect).

I know I'm getting it all wrong. Can someone please help me clear this concept?

3
  • We're really not sure what you're asking.
    – ergonaut
    Sep 26, 2015 at 17:54
  • Yeah that example which I wrote didn't make much sense. I was just trying to find out the differences between ADT and Primitive data types.
    – Divyansh
    Sep 26, 2015 at 18:14
  • 1
    imagine you want to find floor(log_base(2, x)) of a floating number x. If you do this by reading actual specific bits for a float's exponent from memory according to the IEEE specification, you're using the knowledge about the specific representation of your data type, i.e. you treat it as a concrete data type. But if you only call the provided functions, you treat is as an abstract data type. Same with addition of integers, you either manipulate the bits yourself, or just call +.
    – Will Ness
    Sep 26, 2015 at 23:29

3 Answers 3

5

Data types are classification of data in any programming language - for example integers, characters, floats etc.

Abstract Data type is a theoretical concept. An abstract data type (ADT) is a mathematical model for data types where a data type is defined by its behaviour (semantics) 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 behaviour of these operations.A set of data values and associated operations that are precisely specified independent of any particular implementation. Abstract data type (ADT) is a specification of a set of data and the set of operations that can be performed on the data.

For Example : Stack is an Abstract Data Type. A stack ADT can have the operations push, pop, peek. These three operations define what the type can be irrespective of the language of the implementation.

So we can say, Primitive data types are a form of Abstract data type. It is just that they are provided by the language makers and are very specific to the language. So basically there are 2 types of data types primitives and user defined. But both of them are abstract data types. I hope this makes it clear.

1
  • 2
    I am not sure how Primitive data types can be called an ADT - as there is no abstraction to them. They are pure data/data containers. The Non-Primitive / User defined data types on the other hand stores the reference to the memory location of data and are mainly concerned with the design and usage of those 'data containers' e.g. a Stack of integers, a Queue of text message. Abstract Data types are sub-set of Non-Primitive which are mainly just an Interface - defining only the behavior e.g. java.util.List
    – Vibha
    Nov 18, 2020 at 5:59
-1

Abstract Data Types - These are the building blocks for manipulating data that would otherwise just be a string of 1s and 0s. Would you rather have liquid metal, or nuts and bolts to build with?

-1

It is long since this question was asked but I have an answer that might be a little bit clearer.

Data Type - Deals with a set of values, their representation and a set of operations that can be applied to them.

Abstract Data Type (ADT) - Deals with a set of values and a set of operations that can be performed on them.

The difference between the two is that ADT is not concerned with the representation of these values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.