Application of Data- Structure
Tags: Arrays, Data Structures, Application, Data, Algorithms

DATA-STRUCTURE

A data structure is a particular way of organizing data in a computer so that it

can be used effectively.

>>Data structures are the means of storing data in a very effective manner.

Each structure has different ways in which data is inserted, deleted, or queried.

>>Data structures can be linear or non-linear, based on the way their data is

accessed. Linear are those in which data is stored in a sequential manner, and

can be accessed in a sequence too. Non-linear are those which hold the data

together without focusing on its sequence. The data cannot be arranged or

accessed in a sequence

>>For example, we can store a list of items having the same data-type using

the array data structure.

>>There are a lot examples of data structure where we can store data in different

forms, It consist wide variety of storing , Traversing , Merging etc

Data structure are represented and used in different form such as :

1) Array , 2)Stack , 3)Queue , 4)Linked-List ,

5)Heap , 6)Graph , 7)Tree , 8)Hash-Table

1) Array :An array is a data structure for storing more than one data item that

has a similar data type. The items of an array are allocated at adjacent

memory locations. These memory locations are called elements of that array.

An array is a container of elements.

Elements have a specific value and data type, like “ABC”, TRUE or FALSE,

etc.

Each element also has its own index, which is used to access the element

2) Stack : Stack is a linear data structure which follows a particular order in

which the operations are performed. The order may be LIFO(Last In First Out)

or FILO(First In Last Out).

A stack can be implemented by means of Array, Structure, Pointer, and Linked

List. Stack can either be a fixed size one or it may have a sense of dynamic

re-sizing. Here, we are going to implement stack using arrays, which makes it

a fixed size stack implementation.

Stack operations may involve initializing the stack, using it and then

DE-initializing it. Apart from these basic stuffs, a stack is used for the following

two primary operations −

push() − Pushing (storing) an element on the stack.

pop() − Removing (accessing) an element from the stack.

Some functions of stack are :

peek() − get the top data element of the stack, without removing it.

isFull() − checks if stack is full.

isEmpty() − checks if stack is empty.

3) Queue : A Queue is a linear structure which follows a particular order in

which the operations are performed. The order is First In First Out (FIFO). A

good example of a queue is any queue of consumers for a resource where the

consumer that came first is served first. The difference between stacks and

queues is in removing. In a stack we remove the item the most recently added;

in a queue, we remove the item the least recently added.

Queue operations may involve initializing or defining the queue, utilizing it, and

then completely erasing it from the memory.

enqueue() − add (store) an item to the queue.

dequeue() − remove (access) an item from the queue.

Some Functions of queue are:

peek() − Gets the element at the front of the queue without removing it.

isfull() − Checks if the queue is full.

isempty() − Checks if the queue is empty.

In queue, we always dequeue (or access) data, pointed by front pointer and while

enqueing (or storing) data in the queue we take help of rear pointer.

4)Linked-List: A linked list is a sequence of data structures, which are

connected together via links.A linked list is different from an array in the order

of the elements within the list that is not determined by contiguous memory

allocation. Instead, the elements of the linked list can be sporadically placed in

memory due to its design, which is that each element of the list (also referred

to as a ‘node’) consists of two parts:

1. The data

2. A pointer

Following are the important terms to understand the concept of Linked List.

Link − Each link of a linked list can store a data called an element.

Next − Each link of a linked list contains a link to the next link called Next.

LinkedList − A Linked List contains the connection link to the first link called

First.

Types of Linked List:

Following are the various types of linked list.

Simple Linked List − Item navigation is forward only.

Doubly Linked List − Items can be navigated forward and backward.

Circular Linked List − Last item contains link of the first element as next and

the first element has a link to the last element as previous.

Basic Operations

Following are the basic operations supported by a list.

Insertion − Adds an element at the beginning of the list.

Deletion − Deletes an element at the beginning of the list.

Display − Displays the complete list.

Search − Searches an element using the given key.

Delete − Deletes an element using the given key.

5). Heap: A Heap is a special Tree-based data structure in which the tree is a

complete binary tree. Generally, Heaps can be of two types:

1. Max-Heap: In a Max-Heap the key present at the root node must be

greatest among the keys present at all of it’s children. The same property

must be recursively true for all sub-trees in that Binary Tree.

2. Min-Heap: In a Min-Heap the key present at the root node must be

minimum among the keys present at all of it’s children. The same

property must be recursively true for all sub-trees in that Binary Tree.

6). Tree:A tree is a hierarchical structure where data is organized

hierarchically and are connected together. This structure is different from a

linked list whereas, in a linked list, items are linked in a linear order.

A tree contains “nodes” (a node has a value associated with it) and each node

is connected by a line called an “edge”. These lines represent

the relationship between the nodes.

The top-level node is known as the “root” and a node with no children is a “leaf”.

If a node is connected to other nodes, then the preceding node is referred to as

the “parent”, and nodes following it are “child” nodes.

There are various incarnations of the basic tree structure, each with their own

unique characteristics and performance considerations:

 Binary Tree

 Binary Search Tree

 Red-Black Tree

 B-tree

 Weight-balanced Tree

 Heap

 Abstract Syntax Tree

7). Graph : A Graph is a non-linear data structure consisting of nodes and

edges. The nodes are sometimes also referred to as vertices and the edges are

lines or arcs that connect any two nodes in the graph.

More formally a Graph can be defined as A Graph consist of a finite set of

vertices and set of edges which connect a pair of nodes.

8) Hash-Table: Hash Table is a data structure which stores data in an

associative manner. In a hash table, data is stored in an array format, where

each data value has its own unique index value. Access of data becomes very

fast if we know the index of the desired data.Thus, it becomes a data structure

in which insertion and search operations are very fast irrespective of the size

of the data. Hash Table uses an array as a storage medium and uses hash

technique to generate an index where an element is to be inserted or is to be

located from.

Basic Operations:

Following are the basic primary operations of a hash table.

Search − Searches an element in a hash table.

Insert − inserts an element in a hash table.

delete − Deletes an element from a hash table.