Arrays,Linkedlists,Stacks,Queues,Trees and Graphs

Arrays,Linkedlists,Stacks,Queues,Trees and Graphs

Arrays,LinkedLists,Stacks,Queues,Trees and Graphs

Arrays:It is a linear list ofHOMOGENEOUSdata items stored atCONTIGUOUSmemory locations.

  1. Linked List:It is a collection ofNODES,where node is a memory block which is divided into two parts:INFORMATIONfield andADDRESSfield. Information field holds the data part and Address part holds the address of the next node.

3.Stack:It is a linear List of elements, elements can be inserted or deleted only at one
end called theTOPof the stack. It uses the concept of LIFO (Last In First Out).
Consider the example of Stack: CD case, In CD case you put the CD one by one and the
last CD would be the one that will be first taken out from the CD case.
4.Queues:It is the list of elements, element can be inserted only at one end called the REAR end and element can be deleted only at other end called the FRONT end. It uses
the concept of FIFO (First In First Out).You acn consider the example of queue at
the registration counter. The person standing at first position will be the one who get
first registered at the person standing at the last position will be registered at the last.
5.Trees:It is a non linear Data Structure ,which is hierarchical in nature and must
maintain a hierarchy.
6.Graphs:It is a non linear data structure in which it is not necessary that the
relationship between the data items is in hierarchy.

Applications

These data structures are widely used in many problems. Many times these are combined or modified according to the problem.
For example :-
1) Stack is used in implementing recursive functions
2) Queue is used in serving requests of a single shared resource (printer, disk, CPU)
3) Linked list is used in implementing stacks, queues
4) Trees and graphs are used to implement search algorithms like bfs, dfs, and hence can be used to check connectivity of two nodes, or to find shortest distance between them