Data Structures: Lecture No. 1
Data Structures: Lecture No. 1
Introduction
Asim Rehan
Lecture No. 1
About you?
• You are here because?
Computer
Programming
How to write software with the help of procedural and object oriented
programming?
Data Structures
How to efficiently utilize resources with the help of different data structures?
Algorithm Analysis
• Graphs
• Heaps FINAL SESSION
What is a data structure?
• The primary purpose of most computer
programs is not only to perform calculations,
but also to store and retrieve information-as
fast as possible.
6
Types of Data Structures
• Linear DS
• In linear DS the values are arranged in a
sequence. Like arrays, Linked list, stack,
queues.
• Non-Linear DS
• Opposite to linear DS. The values are not
arranged in a sequence. Like Trees, Graphs,
and tables
Operations on Data Structures
• Data is useless if it cannot be processed, we must
identify which operations are needed to process the
data for solving given problem.
• Linear Algorithms
– Linear algorithms does something, once to every
object in the collection of objects. Looking up words
in dictionary, adding all numbers in an array.
• Divide and Conquer
– divide the problems in to pieces and work on the
pieces.
• Greedy Algorithms
– try to solve problems by selecting the best piece
first and then the smaller one latter. First biggest
value in the array then smaller.
• Iterative Algorithms
– in order to obtain correct result we start with a
value and repeatedly change in the direction of
solution, like factorial till zero.
Where Data Structure is Helpful?
• The choice of efficient data structure makes
the difference between a program running in a
few seconds or many days
What is Data Structure Efficiency?
• A solution is said to be efficient if it solves the
problem within its resource constraints.
– Space
– Time