Unit 1-fds-2020
Unit 1-fds-2020
Data Structure”
Prepared By
17AUG. 2023
.
SYLLABUS
Introduction: From Problem to Program (Problem, Solution, Algorithm,
Data Structure and Program).
Data Structures: Data, Information, Knowledge, and Data structure,
Abstract Data Types (ADT), Data Structure Classification (Linear and
Non-linear, Static and Dynamic, Persistent and Ephemeral data structures)
Algorithms: Problem Solving, Introduction to algorithm, Characteristics
of algorithm, Algorithm design tools: Pseudo-code and flowchart.
Complexity of algorithm: Space complexity, Time complexity,
Asymptotic notation- Big-O, Theta and Omega, finding complexity using
step count method, Analysis of programming constructs-Linear,
Quadratic, Cubic, Logarithmic.
Algorithmic Strategies: Introduction to algorithm design strategies-
Divide and Conquer, and Greedy strategy.
INTRODUCTION
Introduction
Computer : A programmable device that can store, retrieve,
and process data.(Combination of H/w & S/w )
Data :
“Data is nothing but collection of information i.e.
facts or figures.”
Data Object :
“Data object is a region of storage that
contains a value or group of value”
1. Stores huge data
6. Better algorithms
ABSTRACT DATA TYPE
ADT :
“Abstract data types are mathematical models of a set
of data values or information that share similar behavior or qualities and that
can be specified and identified independent of specific implementations.
Abstract data types, or ADTs, are typically used in algorithms.”
Linear data structures are easy to implement These data structures are difficult to
implement.
Implementation: Linear data structures are Implementation: Non-linear data structures
implemented using array and linked lists are mostly implemented using linked lists.
e.g: The basic linear data structures are list, e.g: The basic non-linear data structures are
stack and queue. trees and graphs.
For the implementation of linear data For the implementation of non-linear data
structures, we don’t need non-linear data structures, we need linear data structures.
structures.
USE: These are mostly used in application USE: These are used for the development of
software development. game theory, artificial intelligence, image
processing
1. Static data strucure :
“A static data structure is an organization or collection
of data in memory that is fixed in size.”
Ex: Arrays
Problem :
“Problem is defined as situation or condition which needs
to solve to achive goal”
3. Merging solution
From the data structure point of view, following are some important
categories of algorithms −
Step 1 − START
Step 6 − print c
Step 7 − STOP
ALGORITHM DESIGN TOOL
• There can be two tools :
1. Flowchart
2. Pseudo Code
Flowchart :
“ Flowchart is graphical representation of the algorithms”
Pseudo Code :
“It is simply an implementation of an algorithm in the form of
annotations and informative text written in plain English.
An insVuctian or a command.
1. Larger problem divided into smaller Smaller pieces are combined together
2. Execution Start from top to down Execution start from bottom to top
Time complexity :
“The time which is required for analysis of given problem
of particular size is known as time complexity”
Space complexity :
“The amount of computer memory required tp solve the
given problem of particular size is called as space complexity”
gi
constant — 0{1)
logarithmic — 0(log n)
linear o(nl
n log n — 0{n log n)
quadratic — o(n^)
cubic — o(n^)
polynomial —
exponential —
Analysis of Programming Construct
Algorithmic
Strategies
ALGORITHMIC STRATEGIES
Algorithm design strategies are the general approaches used to
develop efficient solution to problem.
2. Merge sort
3. Recursive algorithm
4. Backtracking algorithms
5. Heuristic algorithms
disks. The objective of the puzzle is to move the entire stack to another
2) Each move consists of taking the upper disk from one of the stacks and
placing it on top of another stack i.e. a disk can only be moved if it is the
Algorithm Steps :
Start adding edges to the MST from the edge with the smallest weight
until the edge of the largest weight.
Only add edges which doesn't form a cycle , edges which connect only
disconnected components.
GREEDY STRATEGIES
2. Kruskal’s algorithms : Example
.
GREEDY STRATEGIES
2. Kruskal’s algorithms : Example
.
GREEDY STRATEGIES
2. Prims algorithm: Prim’s Algorithm also use Greedy approach to find the
minimum spanning tree. In Prim’s Algorithm we grow the spanning tree
from a starting position. Unlike an edge in Kruskal's, we add
vertex to the growing spanning tree in Prim's.
Algorithm Steps:
2. Find all the edges that connect the tree to new vertices, find the minimum
and add it to the tree.
Email : [email protected]