LECTURE # 01
INTRODUCTION TO DATA
STRUCTURE
Instructor:
Ms.Dur-e-Shawar Agha
ROAD MAP
➢ Data Structures
➢ Main Classification and Operation Of Data Structures
➢ Types Of Data Structures
ARRAY
STACK
QUEUE
LINKLIST
TREE
GRAPH
➢ Some Examples /Applications
INTRODUCTION TO DATA STRUCTURE
Data: Data is raw facts and figures
example: 22, 23 rupees, 0211234567
Information: Something that depicts knowledge.
example: Alice is 22 years old.
Chocolate is of 23 rupees.
Her phone number is 0211234567
Structure: Way of organizing or storing
information so that we can use it easily. Method
to use, search data easily.
DATA STRUCTURES
The term Data Structure refers to a scheme for
organizing pieces of information .
OR
The logical arrangement of data elements, combined with
the set of operations we need to access the elements.
In computer science, a data structure is a particular way
of storing and organizing data in a computer’s memory
so that it can be used efficiently.
ORGANIZING DATA
Any organization for the collection of records that
can be searched, processed in any order, or
modified.
The choice of data structure and algorithm can
make the difference between a program running
in a few seconds or many days.
EFFICIENCY
A solution is said to be efficient if it solves the
problem within its resource constraints
i) Space
ii) Time
The cost of a solution is the amount of resources
that the solution consumes.
SELECTING A DATA STRUCTURE
Select a data structure as follows:
Analyze the problem to determine the resource
constraints a solution must meet.
Determined the basic operations that must be
supported. Quantify the resource constraints for
each operation.
Select the data structure that best meets these
requirements.
CLASSIFICATION OF DATA STRUCTURE
DATA STRUCTURE OPERATIONS
Following are the basic operations.
✓ Traverse − Print all the array elements one
by one.
✓ Insertion − Adds an element at the given
index.
✓ Deletion − Deletes an element at the given
index.
✓ Search − Searches an element using the
given index or by the value.
✓ Update − Updates an element at the given
index.
✓ Merge – combine the elements of two
different arrays
MAIN CLASSIFICATION OF DATA STRUCTURE
LINEAR AND NON-LINEAR
In linear data structure all the data are stored linearly or
contiguously in the memory. All the data are saved in
continuously memory locations.
The non-linear data structure is a data structure in
which the elements are not stored contiguously in
memory, the data elements are scattered in the memory.
DATA STRUCTURE HIERARCHY
LINEAR DATA STRUCTURE
ARRAY
An array data structure or linear list is a data structure
consisting of a homogenous collection of elements.
STACK
A stack is a data structure consisting a list of elements in
which elements can be inserted or deleted at one end which
is known as TOP of the stack.
Push: Adding an element to the Top of stack.
Pop: Deleting an element from the Top of the stack.
QUEUE
A queue is a linear list of data elements in which one end
which is known as front and other end is known as rear.
Insertion: Add an element in the rear end of a queue.
Deletion: Deleting an element from the front end of a queue.
LINKED LIST
A linked list is a linear collection of data elements.
A linked list consists of two important parts, first part
named as info contains the data and the other part named
as link consists of a link to the next element.
NON-LINEAR DATA STRUCTURE
TREE
A tree is a widely used data structure that represents data in a
hierarchical tree structure with a set of linked nodes.
GRAPH
A graph data structure consists of finite set of ordered
pairs, called edges or arcs, of certain entities called nodes
or vertices.
For example, an edge (a,b) is said to point or go from a to
b.
SOME PRACTICAL USAGE OF DATA
STRUCTURES IN COMPUTERS
Stack
For any Recursive operation (Repeated Action).
Queue
For all the FIFO scenarios .
Link list
For all the RDBMS (Relational Database
Management System).
Trees
For searching scenarios.
Graph
For Google maps.
SUMMARY
Introduction to Data Structure
Types of Data Structure
Operations on Data Structure