Abstract Data Types
Abstract Data Types or ADT is a class of objects whose behavior is defined by a set of values or operations. In ADT, we can use various operations, but the working of the operations is totally hidden from the user.
It is made up of primitive data types, but the logic is hidden.
Examples of ADT are stack, queue, and list.
- Stack ADT
The operations in Stack ADT are as follows:
| isFull() | It checks if the stack is full or not. |
| isEmpty() | It checks if the stack is empty or not. |
| pop() | It deletes one element from the top of the stack. |
| peek() | It gets the top element in the stack. |
| push(x) | It pushes x into the stack. |
| size() | It checks the size of the stack. |
- Queue ADT
The operations in queue ADT is as follows:
| delete() | It deletes the element from the front queue. |
| isFull() | It checks if the queue is full. |
| isEmpty() | It checks if the queue is empty. |
| insert(x) | It inserts x to the rear end of the queue. |
| size() | It returns the size of the queue. |
- List ADT
| replace(x,y) | It replaces x with y in the list. |
| insert(x) | It inserts x into the list. |
| remove(x) | It removes x from the list. |
| get(i) | It places an element at position i. |
Reference
