Muhammad Banhawy
Muhammad Banhawy

Reputation: 11

Data Structure - Abstract data type VS Concrete data type

Abstract data type (ADT) : Organized data and operations on this data Examples : Stack, Queue what's meaning of Concrete data type (CDT)?

please explain by Examples.

Upvotes: 1

Views: 1944

Answers (1)

AminM
AminM

Reputation: 856

One way to understand it is that an ADT is a specification of an object with certain methods.

For example if we talk about a List we are referring to an object that performs list operations such as:

  • add to the beginning
  • add to the end
  • insert at position
  • size
  • etc..

A "concrete data type" in this context would refer to the actual Data Structure you use to implement the list.

For example, one implementation of a List is to create nodes with a value and next pointer to point to the next node in the list.

Another is to have a value array, and a next array to tell you where the next node is (this is a more popular implementation for parallelism).

And yet another is to have a dynamic array (known as an ArrayList in Java) where you use an array till it fills up and then you duplicate it's size and copy the values to the new array.

So the concrete data type refers to the data structure actually being used, whereas the ADT is the abstract concept like List, Dictionary, Stack, Queue, Graph, etc..

There are many ways to implement an ADT.

Upvotes: 0

Related Questions