Abstract Data Type in Data Structures

Data Structure AlgorithmsAnalysis of AlgorithmsAlgorithms

The Data Type is basically a type of data that can be used in different computer program. It signifies the type like integer, float etc, the space like integer will take 4-bytes, character will take 1-byte of space etc.

The abstract datatype is special kind of datatype, whose behavior is defined by a set of values and set of operations. The keyword “Abstract” is used as we can use these datatypes, we can perform different operations. But how those operations are working that is totally hidden from the user. The ADT is made of with primitive datatypes, but operation logics are hidden.

Some examples of ADT are Stack, Queue, List etc.

Let us see some operations of those mentioned ADT −

  • Stack −
    • isFull(), This is used to check whether stack is full or not
    • isEmpry(), This is used to check whether stack is empty or not
    • push(x), This is used to push x into the stack
    • pop(), This is used to delete one element from top of the stack
    • peek(), This is used to get the top most element of the stack
    • size(), this function is used to get number of elements present into the stack
  • Queue −
    • isFull(), This is used to check whether queue is full or not
    • isEmpry(), This is used to check whether queue is empty or not
    • insert(x), This is used to add x into the queue at the rear end
    • delete(), This is used to delete one element from the front end of the queue
    • size(), this function is used to get number of elements present into the queue
  • List −
    • size(), this function is used to get number of elements present into the list
    • insert(x), this function is used to insert one element into the list
    • remove(x), this function is used to remove given element from the list
    • get(i), this function is used to get element at position i
    • replace(x, y), this function is used to replace x with y value
raja
Published on 27-Aug-2019 10:49:28
Advertisements