Sunday, 19 November 2017

Different Types of data Structures With Real Time Examples

All Most in all Technical interview rounds frequently asked question is "What is Data Structure?"
Don’t say simply “It is a logical way of storing data and also it describes the mechanism of retrieving data.”
How to give Answer :
            First you can give definition after that types of data Structure and then operations performed on each type with examples. (Even though Technical HR didn’t ask different types)
Different-Types-of-data-Structures-With-Real-Time-Examples

Okay, Now let see What is Data Structure? Different Types of data Structures?

What is Data Structure?
            It is a logical way of storing data and also it describes the mechanism of retrieving data.”

Data Structure types :


Data Structures are two types

            1) Linear (A linear data structure traverses the data elements sequentially, in which only one data element can directly be reached)

            2) Non Linear (A non-linear data structure is a data structure in which a data item is connected to several other data items. So that a given data item has the possibility to reach one-or-more data items.)

Operations Performed on Data Structure :

A) Traversing : Accessing each Record exactly once, so that certain Item in the record may be processed
B) Searching : Finding the location of the record with the given key value
C) Insertion : Add a new record to the structure
D) Deletion : Removing a record from the structure

Examples For Linear data Structures are :
>  Array
> Stack
> Queue
> Linked List

Array (one of the example of Linear data Structures):

            An array is a collection of same type of data elements. An Array is a collection of elementes
Operations Performed on Array:

A) Traversing : Accessing each Record exactly once, so that certain Item in the record may be processed

B) Searching : Finding the location of the record with the given key value

C) Insertion : Add a new record to the structure

D) Deletion : Removing a record from the structure

E) Sorting

F) Merging

Stack (one of the example of Linear data Structures):

            A stack is a list of Elements in which an element is inserted or deleted at one End. That means, it follows the rule of "First In Last Out- (FILO)"

Operations Performed on Stack :

A) Push : Add an Element into Stack

B) POP : Remove an Element from Stack

Example:

Real Time Example For Stack is Lift

Queue (one of the example of Linear data Structures):

             A Queue is a linear list of element in which insertion will be done at one end (which is known as front end) and deletion can be done at another end (Rear End). That is It follows the rule of "First in First Out (FIFO)"

Operations Performed on Queue :

A) Insertion : Add a new element into the Queue

B) Deletion : Removing a element from the Queue

Example :

Real Time Example for Queue is a ticket counter

Linked List (one of the example of Linear data Structures):

            Linked List a linear collection of data elements. It has two parts one is "Info part" and another is "Link Part". Info Part Gives information and Link part gives Address of next node

Operations Performed on Linked List:

A) Traversing : Accessing each Record exactly once, so that certain Item in the record may be processed

B) Searching : Finding the location of the record with the given key value

C) Insertion : Add a new record to the structure

D) Deletion : Removing a record from the structure

2) Examples For Non-Linear data Structures are :


> Tree
> Graph

> Tree :

            In computer Science a Tree is a widely used data structure that emulates a hierarchical tree  structure with a Set of Linked List

Operations Performed on Tree :

A) Searching : Finding the location of the record with the given key value

B) Insertion : Add a new record to the structure

C) Deletion : Removing a record from the structure

> Graph :

             A Graph is a collection of nodes called “vertices” & the connections between them called “edges”

The following Example shows a graph with 3 Vertices and 4 Edges

1,2,3 are vertices and directions are edges

Graph Example

Operations Performed on Graph :

A) Searching : Finding the location of the record with the given key value

B) Insertion : Add a new record to the structure

C) Deletion : Removing a record from the structure

Note : When Technical HR ask question like " tell me about Data structures ". Then you should be ready to give answer that what I am explained above. If you explain like this then there is no other question to you – 90% Selected.

Fresher? Register Online Here