2. Data
• Information that is stored in a computers.
• Various format like a numeric data, a non numeric
data or a character data.
• Stored in a storage device in the computer which
can be primary or secondary.
• Data travel in two directions that are from a user
to computer or from computer to user.
• Data give by the user to computer is termed as an
input data, given by a computer to user is termed
as an output data.
• Input data is to be stored in a computer system
either temporarily or permanently.
3. Concept and need of Data Structure
Structure or a format that is created by the programmer in a program to
store and manipulate user data.
The smallest and simplest data structure used in a program to store a user
data is a variable.
The problem with the variable is that it can store only one data at a time.
Thus to store multiple data at one place we can use as array data
structure. But the problem with array is that it does not support insertion
and deletion operations. Also it stores only one type of data in it.
Thus to store different types of data we can use structures. But even
structures do not support insertion and deletion operation.
So for this purpose we can implement some other linear and non-linear
data structure in our program like: Stacks, Queues, Linked lists, Trees and
graphs.
Data structures are used in every program or software system to arrange
the data.
Data Structures are a specialized means of organizing and storing data in
computers in such a way that we can perform operations on the stored
data more efficiently.
4. Uses of Data Structure
1.Data structures are being used in almost
every program or software system that has
been developed.
2.To store the customer order information
3.In contact lists, etc.
5. Types of data structure (Classification of Data Structure)
Data Structure
Primitive Non Primitive
int, char, float, Arrays, lists, structures, files
double, pointers
Linear Non Linear
stacks, queues, trees, graphs
linked lists
6. Operations on Data Structure
Traversing
In this operation we access each data item of a data structure in order to process it.
Insertion
In this operation we can insert a new data item in to the structure.
Deletion
In the operation we can remove an existing data item from the data structure.
Searching
In this operation we find the location of a given data item in the data structure. If
the element is found; we return its location otherwise we return null.
Sorting
In this operation we sort arrange the data items in the data structure either in
ascending or descending order.
Merging
In this operation we combine the data items of two similar sorted data structures in
to one single structure.
7. Linear
Stack
A stack is an ordered collection of items into which new item
can be inserted one end, and can be removed from same end
called as a top of the stack.
Queue
An ordered collection of items from which items may be
deleted from one end called the front and into which items
may be inserted from other end called rear is known as
Queue.
Linked List
A linked list is defined as a collection of nodes.
A node represents a small area of main memory used to store
the user data and pointers to previous and next data items in
the list in sequence.
8. Non Linear
1. Tree
Tree is a non- linear data structure defined as collection of nodes and lines.
It can also be defined as a set of elements which is either empty or
partitioned into three disjoint subsets.
i. The first subset is the root node.
ii. The other two subsets are called as left and right subtrees which
themselves are trees. Consider following tree:
9. 2. Graph
A graph is an image that represents data symbolically.
A graph is used to represent complex information and in
simple, compact format.