You are on page 1of 15

Data Structures

&
Algorithms

1
Data Structures (how to organize data) and
Algorithms (how to manipulate data) are
the cores of today’s computer
programming

2
Data Structures + Algorithms = Programs

•Algorithm analysis – determining how long an


algorithm will take to solve a problem

3
Why algorithm analysis?

As computers get faster and problem sizes get


bigger, analysis will become more important.

Why? The difference between good and bad


algorithms will get bigger.

4
Choosing an Algorithm

 Performance requirements
– Time complexity
 Memory requirements
– Space complexity

5
Space Complexity

 Instruction space
 Data space
 Environment stack space

6
Time Complexity
 Will the algorithm gives a satisfactory real-
time response

 There may be several possible solutions


with different time requirements

7
Big Oh Notation:
 If f(n) and g(n) are functions defined on
positive integer number n, then
f(n) = O(g(n)),
if there exists positive constants c and
n0, such that f(n) < = c* g(n) for all values
of n > = n0

8
Why data structures?

When programming, you are an engineer.


Engineers have a bag of tools and tricks – and
the knowledge of which tool is the right one
for a given problem.

Arrays, lists, stacks, queues, trees, hash tables,


graphs.

9
Basic Terminology
 Data
– Refers to a value or set of values
 Data Item
– Refers to a single unit of values
 Entity
– An Entity is something that has certain attributes or
properties which may be assigned values
 Entity Set
– An entity set is a collection of similar entities

10
Cont:
 Record
– It is a collection of related records
 File
– It is a collection of related records
 Key
– Primary key
– Alternate key
– Composite key
 Information
– It is a processed data
11
Data type
 A data type is a collection of values and a
set of operations that act on those values

 Types
– Primitive data type
• Data types that are predefined
– Abstract data type
• Abstraction + the operations that can be done on
them
12
Data Structures
 It is a logical model of a particular
organization of data.

 Study includes
– Logical description of the data structures
– Implementation of the data structures
– Quantitative analysis of the data structures

13
Importance of Data Structures

14
Various Data Structures

 Linear Data Structures


– Stacks, queues
 Non Linear Data Structures
– Trees, graphs

15

You might also like