Data Structure

In simple term if i say what is data structure than it is how we organize the data.In the era of IT, the data structure is very famous term.Data structure provide us a way for storing an information.Simple example of data structure for real time scenarios will be as below.

In simple term if i say what is data structure than it is how we organize the data.In the era of IT, the data structure is very famous term.Data structure provide us a way for storing an information.Simple example of data structure for real time scenarios will be as below.

Suppose there are certain people waiting for buying flight tickets,and the receptionist is give them tickets one buy one.In these scenario, people are standing in the queue and waiting for there turn for buying tickets.So here the data structure which is used is called queue.

Consider a another technical scenario where , we are calling methods one by one,For example there is main() mehotd in java, which is calling methodA(),MethodA is calling methodB() and methodB() is calling methodC().Now is this case, each method is saved inside the stack data structure.Stack will work like a bucket where,it follows the LIFO architecture.The last item which came in will be the first on the bucket.

Like wise there are certain other data structure also exist in computer application.Some of other examples are linked list,array,table,graph etc...We will take look on each of them one buy one.

Array

An array is a data structure where we can store an element in sequential way.Array store same types of object together.Memory allocation of array happens in sequential manner.The main benefit of array is we can access the element randomly.

As you can see above, There are three main things when array is concerned.First is memory allocation, each element of an array will be stored in memory in sequential manner.Second is data where the actual element of an array is stored.Third is an index using which we will be able to store or retrieve an element.

Linked List

We know now what the data structure mean, As the name suggest of linked list is the type of data structure where data is stored in a linked manner.Another way of calling it as a chain of data.In the linked list data structure each piece of data is linked with the next piece of data making the chain of data.

As you can see in above image each compartment is linked with another compartment.And each compartment contains the amount of data as well.So we can say that each compartment will carry 2 things one the data which it hold and next will be the chain/link of next compartment.

- Singly Linked List
- Doubly Linked List
- Circular Linked List

Queue

As we discussed earlier on real time scenario of buying flight ticket , this is the best example of queue data structure.There are multiple places where we follow the queue pattern.Other example will be executing certain jobs as a batch processing.Queue follows the FIFO method,which is what ever comes first will be processed first.

Application of queue

- Circular Queue
- Priority Queue
- Deque

Stack

There is not much difference between stack and queue if we look from bird eye view.Stack follows the LIFO architecture where Queue follows the FIFO architecture.Stack will be use full in the place where we need recently added item first.Example of stack in real world would be the example in the daily kitchen activities.In the kitchen when the any person will take the plate it will be from top of the plate and once person is putting it back again it will be on top only.

Trees

A tree is a data structure where each and every element is linked with its parent element and its children element.Only the root element will not have any parent element.There are certain type of tree which are defined in standard data structure.One of the best example of tree data structure is binary tree where each node will be having maximum 2 children.

Graph

There are not major difference between tree and graph.From the structural point of vie it might look same.The important difference, which needs to be noted is, a graph will not have any root element,while a tree will have root element.

There are two major algorithms which are followed for traversing the element of graph.

- Depth First Search
- Breadth First Search

## 0 comments:

## Post a comment