ADT stands for Abstract Data Type. It is a data type that is not tied to any specific instance. ADTs are usually defined in a manner that is independent of the storage implementation. In this tutorial we have introduced you to ADT and have described various important ADT’s with examples, so be sure to check it out! In this article, we will discuss some more ADT’s with examples.
Types of Abstract Data Type’s
There are the following types of ADTs:
a) Unordered ADT’s
b) Ordered ADT’s
c) Searching ADT’s
d) Sorting ADT’s
e) Bit Manipulation ADT
f) Binary Decision Diagrams (BDDs)
g) Universal Set ADT
h) String ADT’s
I’s) Set ADT
j) Graph ADT’s
k) Matrix ADT
n) Linked Lists
p) Disjoint Sets
r) Various Main Classes of ADTs
Unordered ADTs: An unordered abstract data type has no particular order of elements. Hash tables are the most common example of an Unordered ADT.
Elements can be added to the hash table with equal ease irrespective of their positions in the table. Therefore, searching for an element is difficult without sorting them beforehand. You have already seen some examples of Unordered Abstract Data Type like Array, Stack, etc.
Ordered Adt’s: An ordered abstract data type has elements in some particular order. Even though the order may not matter for some operations, it matters a lot when searching is to be done.
If you take an ordered list of words like A, B, C… X, Y… z; here it can be assumed that A comes before B and so on. So if you are told to search for the word Z then you will put your finger at the end of the sequence (given that both ends are included) i.e.
starting from the end and moving towards the beginning e.g.: Z, Y, X….., W since Z appears after W in this list so keep following the same direction or direction opposite to search order to find out Z rather than moving away from the last element which is Z.
Searching ADTs: A searching abstract data type contains some particular order and some elements can be searched but not all of them e.g.:
Sorting Adt’s: A sorting abstract data type is an ordered abstract data type where the insertion order of elements is preserved. e.g.: Insertion Sort algorithm can be used to sort the list in O(n2) time complexity while Bubble Sort, Selection Sort, etc algorithms work on this concept and perform better than Insertion Sort algorithm. You have already seen some examples of Sorting Abstract Data Types like arrays, Trees, etc.
Bit Manipulation ADT: Bit manipulation is a special kind of algorithmic design that works with bits rather than numbers or characters as input and output values.
In bit manipulation, operations are performed at bit level instead of character or number level because it requires only a few CPU clock cycles to fetch/store a single bit as compared to fetching/storing a whole number or character. For example, the following code calculates sum of two numbers whose bits are reversed i.e.:
Binary Decision Diagrams (BDDs): A binary decision diagram is a special kind of tree where each non-leaf node has two children and represents an arbitrary logical formula involving Boolean operators AND, OR, XOR, NOT, IMPLIES, etc.
A leaf node represents the value of that variable. For example, the following diagram is a Binary Decision Diagram for formula x + y <= z where logical operators are denoted by capital letters e.g.:
The root node represents the variable X which has value 1 here since x + y <= z is TRUE condition. And remaining nodes represent their respective values as shown in the tree data structure using colors i.e., green color codes are true and blue color codes are false.
You have already seen some examples of Bit Manipulation ADT like Binary Decision Diagrams (BDDs), Set ADT, etc.
Set ADT: A set abstract data type stores elements in an unordered manner without duplicates. e.g.:
Hash Tables: A hash table is a special kind of tree-based abstract data type where each internal node has degree 2 and represents a one-to-one mapping between its children nodes i.e., every child node points to only one element of input/output array while leaf nodes represent actual elements. For example, the following hash table stores elements in O(1) time complexity.
Here starting index of integer array is 4 while ending index is 11 so total number of elements are 6 i.e., 4 + 1 + 1 = 6 here.
Trie Data Structure: A trie data structure represents a special kind of tree-based abstract data type where each node has degree > 2 and children nodes point to only one element from the input/output array, unlike hash tables where each internal node can map more than one element to a child node(s). e.g.:
Binary Tree: A binary tree is a special kind of tree where each node has degree two and its children nodes represent smaller one-to-one mapping than set and hash table data structures.
Here 0 represents the left child and 1 represents the right child and > operator denotes parent node relation.
In this example, we can see that the starting index is 5 and it traverses until depth 3 since 19 – 1 – 2 – 2 – 1 = 3. You have already seen some examples of Bit Manipulation ADT like Binary Decision Diagrams (BDDs), Set ADT, etc.
Self-Organizing List: A self-organizing list is a dynamic array data structure where the absolute position of an item is not important, instead its relative position is used which are usually calculated using different algorithms for quick insertion, deletion, and search operations.
It provides fast storage and retrieval capabilities since each node holds only a few items at any given time i.e., whenever a new element will be inserted it shifts existing elements to the left so that enough space can be created for inserting new elements without slowing down algorithms running time.
For example, the following image shows how sequential insertion operation takes place in a self-organizing list.
Here insertion operation takes place at index 1 since it can no longer accommodate new element at its absolute position 7, therefore it shifts the rest of the elements to left until a sufficiently large open space is created for inserting a new element whose absolute position is 2.
Sorted List: A sorted list is basically a special kind of self-organizing list where all elements are stored in ascending order i.e., minimum value comes first followed by next smaller one and so on
Binary Search Tree: A binary search tree is a kind of self-organizing data structure where all elements are stored in ascending order i.e., minimum value comes first followed by next smaller one and so on
Hash table: A hash table is a symbol lookup data structure that consists of an array-based data structure where each element of input/output array represent key-value pair
Double-ended queue: A Double Ended Queue is a data structure that implements an e-mail system where messages are stored in both forward and backward directions
Self-Organizing Map: A Self-Organizing Map is an unsupervised learning algorithm for discovering the inherent structure in data, particularly when the data are not available beforehand and thus do not fit into the standard row/column format of traditional databases
Hash table: A hash table is a symbol lookup data structure that consists of an array-based data structure where each element of input/output array represent key-value pair, e.g.:
Priority queue: A priority queue is a data structure that supports “operations” insert, delete-min, decrease-key, and extract-min based on an associated comparison function object
Queue: A queue is a collection of objects that supports the operation en queue (add an object to the rear) and dequeue (retrieve and remove the object from the front).
Queues are useful for modeling real-world situations such as customers arriving at a store, packets arriving at a router, or documents arriving at a printer,.
Tree: A tree is an ordered data structure composed of nodes or vertices and edges without having any cycle
AVL Tree: A self-balancing binary search tree is a binary search tree that automatically balances itself, whenever a new node is added to it.