Primitive Data Structure S: Introduction To Data Structures
Primitive Data Structure S: Introduction To Data Structures
Data structures are the ways of organizing and storing data in a computer so that we can
perform several operations efficiently on it. It is widely used in every aspect of computer
science. Some examples of commonly used techniques to organize data are:
Properties:
Stacks
The stack is a data structure following the LIFO(Last In, First Out) principle.
VSRGDC
Queues
The queue is a data structure following the FIFO(First In, First Out) principle.
Linked List
A linked list is a dynamic data structure. The number of nodes in a list is not fixed and
can grow and shrink on demand.
Data structures in which elements are not arranged sequentially are called non-linear
data structures.
Properties:
In these, data elements are attached to more than one element exhibiting the
hierarchical relationship between the elements.
The traversal, insertion, and deletion is not done sequentially.
It utilizes the memory efficiently and does not require a memory declaration in
advance.
Examples: Trees and Graphs.
Trees
VSRGDC
A tree is a hierarchical data structure that stores the information naturally in a
hierarchical style.
Graphs
A graph is a set of objects where some pairs of objects are connected by links. The
interconnected objects are represented by points termed as vertices, and the links that
connect the vertices are called edges.
Sequential Representation
Here we allocate a contiguous slot of the memory. This includes the following structures:
VSRGDC
Arrays, Matrices.
Stack and Queue (Array Implementation)
Binary tree (Array Implementation)
Priority Queue (Array and Heap Implementation)
Hash Table(Open addressing method)
Graph(Adjacency Matrix representation)
Linked Representation
Here we allocate a distinct chunk of the memory connected via pointers or references.
This includes the following structures:
Linked List
Binary tree (list implementation)
Stack and Queue (linked list implementation),
Priority Queue (Linked list and BST Implementation)
Hash Table(The Chaining method)
Graph(Adjacency list representation)
1. Query Operations: This will return some info about the dynamic set. For
example: Search(S, k), FindMax(S), FindMin(S), FindSuccessor(S, x) etc. are the
query operations.
2. Modifying Operations: This will change or update the dynamic set. For
example, Insert(S, x), Delete(S, x), Merge(S1, S2), Sort(D) etc. are modifying
operations.
We can also categories the dynamic set into three categories:
Containers
Store and process the data independent of the content or the key. We can use
Array, Linked list, Stack, Queue, Binary Tree, Graph data structures to implement
the container.
Containers are distinguished by the retrieval order they support. On the basis of
the retrieval order, we can divide it into two parts:
Store and process the data on the basis of key or content. This supports three basic
operations on the basis of the key: Search(D, k), Insert(D, k) and Delete(D, k).
We can use Array, Linked list, BST and Hash Table data structure to implement it.
But among all these data structures, the Hash table provides an efficient
implementation of the basic dictionary operations. (Think!)
Priority Queues
Store, access, and process the data in a priority or specific order on the basis of the
key value. There are two types of priority queue: 1) Min Priority Queue 2) Max
Priority Queue
The basic priority queue support three operations: Insert(PQ, k), FindMin(PQ) or
FindMax(PQ), DeleteMin(PQ) or DeleteMax(PQ).
We can use Array, Linked List, BST and Heap to implement both min or max
priority queue. But among all these data structures, heap provides an efficient
implementation of the priority queue. (Think!)
VSRGDC
Note: Certain dictionary data structure like BST support other useful operations like: