SlideShare a Scribd company logo
Tuesday, March 28,
2023
1
Data Structures & Algorithms
Represented By
Nale Rajesh K.
(Lecturer COE Malegaon (Bk))
Introduction To Algorithms
Tuesday, March 28,
2023
2
How do we solve problems?
 We "just do"
 Guesswork-and-luck
 Trial-and-error
 Experience (possibly someone else's)
 "Scientifically"
Tuesday, March 28,
2023
3
0100111010110010101010101
0010101010101001100101010
1010100101101001110101010
1010010010111010011110101
010111110101010001101…
sterilize(saw,alcohol);
raise_hammer();
lower hammer(fast);
start(saw);
/* etc. etc. */
Patient has elevated
pressure in anterior
parietal lobe
The Problem-solving
Process
Problem
specification
Algorithm
Program
Executable
(solution)
Design
Implementation
Compilation
"Doctor, my head hurts"
Analysis
1. Sterilize cranial saw
2. Anaesthetize patient
3. Remove top of skull
4. Get the big spoon...
5. etc., etc.
Tuesday, March 28,
2023
4
sterilize(saw,alcohol);
raise_hammer();
lower hammer(fast);
start(saw);
/* etc. etc. */
The Problem-solving Process
Problem
specification
Algorithm
Program
Executable
(solution)
Analysis
Design
Implementation
Compilation
"Doctor, my head hurts"
Patient has elevated
pressure in anterior
parietal lobe.
1. Sterilize cranial saw
2. Anaesthetize patient
3. Remove top of skull
4. Get the big spoon...
5. etc., etc.
01001110101100101010101010010
10101010100110010101010101001
011010011101010101010010010111
010011110101010111110101010001
10100001101...
Tuesday, March 28,
2023
5
The Problem-solving Process
Problem
specification
Algorithm
Program
Executable
(solution)
Analysis
Design
Implementation
Compilation
Tuesday, March 28,
2023
6
 A sequence of instructions specifying
the steps required to accomplish
some task
 Named after:
Muhammad ibn Musa al-Khwarizmi
of Khowarezm (now Khiva in Uzbekistan)
Algorithm
Tuesday, March 28,
2023
7
 A sequence of instructions
describing how to do a task
Algorithm – Working Definition
[As opposed to actually executing
the instructions]
Tuesday, March 28,
2023
8
Algorithm -- Examples
 A cooking recipe
 Assembly instructions for a model
 The rules of how to play a game
 VCR instructions
 Description of a martial arts
technique
 Directions for driving from A to B
 A knitting pattern
 A car repair manual
Tuesday, March 28,
2023
9
Algorithm – Examples (cont)
 Recipe for Almond and honey slice
 Recipe for Arroz con pollo
Tuesday, March 28,
2023
10
Almond and Honey Slice
1/2 quantity Shotcrust Pastry
185 g unsalted butter
100 g castor sugar
5 tablespoons honey
50 ml cream
50 ml brandy or any other
liqueur or spirit
300 g flaked almonds
Preheat oven for 200° C
Line a 30 cm  20 cm baking
tray with baking paper, and
then with pastry
Bake blind for 20 minutes, then
remove weights and foil
Turn oven up to 220° C.
Bring remaining ingredients to a boil,
stirring.
Spread evenly over pastry.
Bake until topping is bubbling and
has caramelised evenly, about
15 minutes.
Cool before cutting into fingers or
squares.
From: Stephanie Alexander, The
Cook’s Companion, Viking/Penguin,
Ringwood, Victoria, 1996, p. 349.
Tuesday, March 28,
2023
11
Almond and Honey Slice
1/2 quantity Shotcrust Pastry
185 g unsalted butter
100 g castor sugar
5 tablespoons honey
50 ml cream
50 ml brandy or any other
liqueur or spirit
300 g flaked almonds
Preheat oven for 200° C
Line a 30 cm  20 cm baking
tray with baking paper,
and then with pastry
Bake blind for 20 minutes, then
remove weights and foil
Turn oven up to 220° C.
Bring remaining ingredients to a
boil, stirring.
Spread evenly over pastry.
Bake until topping is bubbling and
has caramelised evenly, about
15 minutes.
Cool before cutting into fingers or
squares.
Instructions are given
in the order in which
they are performed
(“executed”)
Tuesday, March 28,
2023
12
Correct Algorithm?
Cut chicken into pieces and
brown the pieces on all
sides in a casserole dish in
hot olive oil.
Remove the chicken and to the
juices in the casserole add
garlic, onions and green
peppers, and sauté until
onion is golden.
Add bay leaf, whole tomatoes,
and chicken broth.
When the broth boils add salt,
saffron and rice.
Arrange chicken on rice, cover
casserole and bake in a
moderate oven (350°F) for
20 minutes or until the rice
is tender.
Add beans and artichokes
during last 10 minutes of
cooking.
Tuesday, March 28,
2023
13
Cut chicken into pieces and
brown the pieces on all
sides in a casserole dish in
hot olive oil.
Remove the chicken and to the
juices in the casserole add
garlic, onions and green
peppers, and sauté until
onion is golden.
Add bay leaf, whole tomatoes,
and chicken broth.
When the broth boils add salt,
saffron and rice.
Arrange chicken on rice, cover
casserole and bake in a
moderate oven (350°F) for
10 minutes.
Add beans and artichokes.
Cover, and bake for another 10
minutes or until rice is
tender.
Correct Algorithm?
Tuesday, March 28,
2023
14
From Algorithms to Programs
Problem
C Program
Algorithm: A sequence
of instructions describing
how to do a task (or
process)
Tuesday, March 28,
2023
15
Components of an Algorithm
 Variables and values
 Instructions
 Sequences
 Procedures
 Selections
 Repetitions
 Documentation
Tuesday, March 28,
2023
16
Values
 Represent quantities, amounts or
measurements
 May be numerical or alphabetical (or
other things)
 Often have a unit related to their
purpose
 Example:
 Recipe ingredients
Tuesday, March 28,
2023
17
Variables
This jar
can contain
10 cookies
50 grams of sugar
3 slices of cake
etc.
Values
Variable
 Are containers for values places to store values
Tuesday, March 28,
2023
18
Restrictions on Variables
 Variables may be restricted to
contain a specific type of value
Tuesday, March 28,
2023
19
Components of an Algorithm
 Values and Variables
 Instruction (a.k.a. primitive)
 Sequence (of instructions)
 Procedure (involving instructions)
 Selection (between instructions)
 Repetition (of instructions)
 Documentation (beside instructions)
Tuesday, March 28,
2023
20
Instructions (Primitives)
 Some action that is simple...
 ...and unambiguous...
 ...that the system knows about...
 ...and should be able to actually do
Tuesday, March 28,
2023
21
Instructions – Examples
 Take off your shoes
 Count to 10
 Cut along dotted line
 Knit 1
 Purl 2
 Pull rip-cord firmly
 Sift 10 grams of arsenic
Directions to perform
specific actions on values
and variables.
Tuesday, March 28,
2023
22
Instructions -- Application
 Some instructions can only be applied
to a specific type of values or
variables
 Examples:
Tuesday, March 28,
2023
23
Instructions (Primitives) --
Recommendations
 When writing an algorithm, make
each instruction simple and
unambiguous
 Example:
Cut chicken into pieces
and brown the
pieces on all sides in
a casserole dish in
hot olive oil.
Cut chicken into pieces.
Heat olive oil in a
casserole dish.
Brown the chicken
pieces in the
casserole dish.
Tuesday, March 28,
2023
24
Instruction (Primitives)
 When writing an algorithm, make
the instructions simple and
unambiguous.
 Example:
Cut chicken into pieces
and brown the pieces
on all sides in a
casserole dish in hot
olive oil.
Cut chicken into pieces.
Heat olive oil in a
casserole dish.
Brown the chicken
pieces in the
casserole dish.
A “sequence” of
simple instructions
Ad

More Related Content

What's hot (20)

Graph coloring problem
Graph coloring problemGraph coloring problem
Graph coloring problem
V.V.Vanniaperumal College for Women
 
Graph coloring using backtracking
Graph coloring using backtrackingGraph coloring using backtracking
Graph coloring using backtracking
shashidharPapishetty
 
Basic Traversal and Search Techniques
Basic Traversal and Search TechniquesBasic Traversal and Search Techniques
Basic Traversal and Search Techniques
SVijaylakshmi
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of Algorithms
Bulbul Agrawal
 
data structures- back tracking
data structures- back trackingdata structures- back tracking
data structures- back tracking
Abinaya B
 
Scaling and shearing
Scaling and shearingScaling and shearing
Scaling and shearing
Mani Kanth
 
Exhaustive Search
Exhaustive SearchExhaustive Search
Exhaustive Search
Kasun Ranga Wijeweera
 
What is Link list? explained with animations
What is Link list? explained with animationsWhat is Link list? explained with animations
What is Link list? explained with animations
PratikNaik41
 
AI_Session 10 Local search in continious space.pptx
AI_Session 10 Local search in continious space.pptxAI_Session 10 Local search in continious space.pptx
AI_Session 10 Local search in continious space.pptx
Guru Nanak Technical Institutions
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
Dhaval Kaneria
 
Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis
Dr. Pankaj Agarwal
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
karthikeyanC40
 
Logic programming (1)
Logic programming (1)Logic programming (1)
Logic programming (1)
Nitesh Singh
 
Spline representations
Spline representationsSpline representations
Spline representations
Nikhil krishnan
 
1 sollins algorithm
1 sollins algorithm1 sollins algorithm
1 sollins algorithm
Muhammad Salman
 
The n Queen Problem
The n Queen ProblemThe n Queen Problem
The n Queen Problem
Sukrit Gupta
 
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPTHOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
Ahtesham Ullah khan
 
Graphs - Discrete Math
Graphs - Discrete MathGraphs - Discrete Math
Graphs - Discrete Math
Sikder Tahsin Al-Amin
 
Numpy tutorial
Numpy tutorialNumpy tutorial
Numpy tutorial
HarikaReddy115
 
Linked list
Linked listLinked list
Linked list
Trupti Agrawal
 
Basic Traversal and Search Techniques
Basic Traversal and Search TechniquesBasic Traversal and Search Techniques
Basic Traversal and Search Techniques
SVijaylakshmi
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of Algorithms
Bulbul Agrawal
 
data structures- back tracking
data structures- back trackingdata structures- back tracking
data structures- back tracking
Abinaya B
 
Scaling and shearing
Scaling and shearingScaling and shearing
Scaling and shearing
Mani Kanth
 
What is Link list? explained with animations
What is Link list? explained with animationsWhat is Link list? explained with animations
What is Link list? explained with animations
PratikNaik41
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
Dhaval Kaneria
 
Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis
Dr. Pankaj Agarwal
 
Logic programming (1)
Logic programming (1)Logic programming (1)
Logic programming (1)
Nitesh Singh
 
The n Queen Problem
The n Queen ProblemThe n Queen Problem
The n Queen Problem
Sukrit Gupta
 
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPTHOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
Ahtesham Ullah khan
 

More from NALESVPMEngg (17)

02-use_cases in Unified modeling languages
02-use_cases in Unified modeling languages02-use_cases in Unified modeling languages
02-use_cases in Unified modeling languages
NALESVPMEngg
 
15 march -22 march 2024 short term program
15 march -22 march 2024 short term program15 march -22 march 2024 short term program
15 march -22 march 2024 short term program
NALESVPMEngg
 
Unit I _ Lecture PPT INTRODUCTION TO IOT PPT (2).pptx
Unit I _ Lecture PPT INTRODUCTION TO IOT PPT (2).pptxUnit I _ Lecture PPT INTRODUCTION TO IOT PPT (2).pptx
Unit I _ Lecture PPT INTRODUCTION TO IOT PPT (2).pptx
NALESVPMEngg
 
bstract Point processing uses only the information in individual pixels to pr...
bstract Point processing uses only the information in individual pixels to pr...bstract Point processing uses only the information in individual pixels to pr...
bstract Point processing uses only the information in individual pixels to pr...
NALESVPMEngg
 
a simple idealized machine used to recognize patterns within input taken from...
a simple idealized machine used to recognize patterns within input taken from...a simple idealized machine used to recognize patterns within input taken from...
a simple idealized machine used to recognize patterns within input taken from...
NALESVPMEngg
 
Stemming is one of several text normalization techniques that converts raw te...
Stemming is one of several text normalization techniques that converts raw te...Stemming is one of several text normalization techniques that converts raw te...
Stemming is one of several text normalization techniques that converts raw te...
NALESVPMEngg
 
Information retrieval is the process of accessing data resources. Usually doc...
Information retrieval is the process of accessing data resources. Usually doc...Information retrieval is the process of accessing data resources. Usually doc...
Information retrieval is the process of accessing data resources. Usually doc...
NALESVPMEngg
 
Information retrieval is the process of accessing data resources. Usually doc...
Information retrieval is the process of accessing data resources. Usually doc...Information retrieval is the process of accessing data resources. Usually doc...
Information retrieval is the process of accessing data resources. Usually doc...
NALESVPMEngg
 
Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...
Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...
Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...
NALESVPMEngg
 
Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...
Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...
Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...
NALESVPMEngg
 
Activity diagrams show the flow of one activity to another within a system or...
Activity diagrams show the flow of one activity to another within a system or...Activity diagrams show the flow of one activity to another within a system or...
Activity diagrams show the flow of one activity to another within a system or...
NALESVPMEngg
 
Activity diagrams show the flow of one activity to another within a system or...
Activity diagrams show the flow of one activity to another within a system or...Activity diagrams show the flow of one activity to another within a system or...
Activity diagrams show the flow of one activity to another within a system or...
NALESVPMEngg
 
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
NALESVPMEngg
 
Wk5_UML_ActivityDiagram.pptx
Wk5_UML_ActivityDiagram.pptxWk5_UML_ActivityDiagram.pptx
Wk5_UML_ActivityDiagram.pptx
NALESVPMEngg
 
TutorialUML.pptx
TutorialUML.pptxTutorialUML.pptx
TutorialUML.pptx
NALESVPMEngg
 
6 Use Case Modeling.pptx
6 Use Case Modeling.pptx6 Use Case Modeling.pptx
6 Use Case Modeling.pptx
NALESVPMEngg
 
Introduction To Data Structures.ppt
Introduction To Data Structures.pptIntroduction To Data Structures.ppt
Introduction To Data Structures.ppt
NALESVPMEngg
 
02-use_cases in Unified modeling languages
02-use_cases in Unified modeling languages02-use_cases in Unified modeling languages
02-use_cases in Unified modeling languages
NALESVPMEngg
 
15 march -22 march 2024 short term program
15 march -22 march 2024 short term program15 march -22 march 2024 short term program
15 march -22 march 2024 short term program
NALESVPMEngg
 
Unit I _ Lecture PPT INTRODUCTION TO IOT PPT (2).pptx
Unit I _ Lecture PPT INTRODUCTION TO IOT PPT (2).pptxUnit I _ Lecture PPT INTRODUCTION TO IOT PPT (2).pptx
Unit I _ Lecture PPT INTRODUCTION TO IOT PPT (2).pptx
NALESVPMEngg
 
bstract Point processing uses only the information in individual pixels to pr...
bstract Point processing uses only the information in individual pixels to pr...bstract Point processing uses only the information in individual pixels to pr...
bstract Point processing uses only the information in individual pixels to pr...
NALESVPMEngg
 
a simple idealized machine used to recognize patterns within input taken from...
a simple idealized machine used to recognize patterns within input taken from...a simple idealized machine used to recognize patterns within input taken from...
a simple idealized machine used to recognize patterns within input taken from...
NALESVPMEngg
 
Stemming is one of several text normalization techniques that converts raw te...
Stemming is one of several text normalization techniques that converts raw te...Stemming is one of several text normalization techniques that converts raw te...
Stemming is one of several text normalization techniques that converts raw te...
NALESVPMEngg
 
Information retrieval is the process of accessing data resources. Usually doc...
Information retrieval is the process of accessing data resources. Usually doc...Information retrieval is the process of accessing data resources. Usually doc...
Information retrieval is the process of accessing data resources. Usually doc...
NALESVPMEngg
 
Information retrieval is the process of accessing data resources. Usually doc...
Information retrieval is the process of accessing data resources. Usually doc...Information retrieval is the process of accessing data resources. Usually doc...
Information retrieval is the process of accessing data resources. Usually doc...
NALESVPMEngg
 
Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...
Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...
Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...
NALESVPMEngg
 
Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...
Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...
Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...
NALESVPMEngg
 
Activity diagrams show the flow of one activity to another within a system or...
Activity diagrams show the flow of one activity to another within a system or...Activity diagrams show the flow of one activity to another within a system or...
Activity diagrams show the flow of one activity to another within a system or...
NALESVPMEngg
 
Activity diagrams show the flow of one activity to another within a system or...
Activity diagrams show the flow of one activity to another within a system or...Activity diagrams show the flow of one activity to another within a system or...
Activity diagrams show the flow of one activity to another within a system or...
NALESVPMEngg
 
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
NALESVPMEngg
 
Wk5_UML_ActivityDiagram.pptx
Wk5_UML_ActivityDiagram.pptxWk5_UML_ActivityDiagram.pptx
Wk5_UML_ActivityDiagram.pptx
NALESVPMEngg
 
6 Use Case Modeling.pptx
6 Use Case Modeling.pptx6 Use Case Modeling.pptx
6 Use Case Modeling.pptx
NALESVPMEngg
 
Introduction To Data Structures.ppt
Introduction To Data Structures.pptIntroduction To Data Structures.ppt
Introduction To Data Structures.ppt
NALESVPMEngg
 
Ad

Recently uploaded (20)

Social Media App Development Company-EmizenTech
Social Media App Development Company-EmizenTechSocial Media App Development Company-EmizenTech
Social Media App Development Company-EmizenTech
Steve Jonas
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Vaibhav Gupta BAML: AI work flows without Hallucinations
Vaibhav Gupta BAML: AI work flows without HallucinationsVaibhav Gupta BAML: AI work flows without Hallucinations
Vaibhav Gupta BAML: AI work flows without Hallucinations
john409870
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Social Media App Development Company-EmizenTech
Social Media App Development Company-EmizenTechSocial Media App Development Company-EmizenTech
Social Media App Development Company-EmizenTech
Steve Jonas
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Vaibhav Gupta BAML: AI work flows without Hallucinations
Vaibhav Gupta BAML: AI work flows without HallucinationsVaibhav Gupta BAML: AI work flows without Hallucinations
Vaibhav Gupta BAML: AI work flows without Hallucinations
john409870
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Ad

Introduction To Algorithms.ppt

  • 1. Tuesday, March 28, 2023 1 Data Structures & Algorithms Represented By Nale Rajesh K. (Lecturer COE Malegaon (Bk)) Introduction To Algorithms
  • 2. Tuesday, March 28, 2023 2 How do we solve problems?  We "just do"  Guesswork-and-luck  Trial-and-error  Experience (possibly someone else's)  "Scientifically"
  • 3. Tuesday, March 28, 2023 3 0100111010110010101010101 0010101010101001100101010 1010100101101001110101010 1010010010111010011110101 010111110101010001101… sterilize(saw,alcohol); raise_hammer(); lower hammer(fast); start(saw); /* etc. etc. */ Patient has elevated pressure in anterior parietal lobe The Problem-solving Process Problem specification Algorithm Program Executable (solution) Design Implementation Compilation "Doctor, my head hurts" Analysis 1. Sterilize cranial saw 2. Anaesthetize patient 3. Remove top of skull 4. Get the big spoon... 5. etc., etc.
  • 4. Tuesday, March 28, 2023 4 sterilize(saw,alcohol); raise_hammer(); lower hammer(fast); start(saw); /* etc. etc. */ The Problem-solving Process Problem specification Algorithm Program Executable (solution) Analysis Design Implementation Compilation "Doctor, my head hurts" Patient has elevated pressure in anterior parietal lobe. 1. Sterilize cranial saw 2. Anaesthetize patient 3. Remove top of skull 4. Get the big spoon... 5. etc., etc. 01001110101100101010101010010 10101010100110010101010101001 011010011101010101010010010111 010011110101010111110101010001 10100001101...
  • 5. Tuesday, March 28, 2023 5 The Problem-solving Process Problem specification Algorithm Program Executable (solution) Analysis Design Implementation Compilation
  • 6. Tuesday, March 28, 2023 6  A sequence of instructions specifying the steps required to accomplish some task  Named after: Muhammad ibn Musa al-Khwarizmi of Khowarezm (now Khiva in Uzbekistan) Algorithm
  • 7. Tuesday, March 28, 2023 7  A sequence of instructions describing how to do a task Algorithm – Working Definition [As opposed to actually executing the instructions]
  • 8. Tuesday, March 28, 2023 8 Algorithm -- Examples  A cooking recipe  Assembly instructions for a model  The rules of how to play a game  VCR instructions  Description of a martial arts technique  Directions for driving from A to B  A knitting pattern  A car repair manual
  • 9. Tuesday, March 28, 2023 9 Algorithm – Examples (cont)  Recipe for Almond and honey slice  Recipe for Arroz con pollo
  • 10. Tuesday, March 28, 2023 10 Almond and Honey Slice 1/2 quantity Shotcrust Pastry 185 g unsalted butter 100 g castor sugar 5 tablespoons honey 50 ml cream 50 ml brandy or any other liqueur or spirit 300 g flaked almonds Preheat oven for 200° C Line a 30 cm  20 cm baking tray with baking paper, and then with pastry Bake blind for 20 minutes, then remove weights and foil Turn oven up to 220° C. Bring remaining ingredients to a boil, stirring. Spread evenly over pastry. Bake until topping is bubbling and has caramelised evenly, about 15 minutes. Cool before cutting into fingers or squares. From: Stephanie Alexander, The Cook’s Companion, Viking/Penguin, Ringwood, Victoria, 1996, p. 349.
  • 11. Tuesday, March 28, 2023 11 Almond and Honey Slice 1/2 quantity Shotcrust Pastry 185 g unsalted butter 100 g castor sugar 5 tablespoons honey 50 ml cream 50 ml brandy or any other liqueur or spirit 300 g flaked almonds Preheat oven for 200° C Line a 30 cm  20 cm baking tray with baking paper, and then with pastry Bake blind for 20 minutes, then remove weights and foil Turn oven up to 220° C. Bring remaining ingredients to a boil, stirring. Spread evenly over pastry. Bake until topping is bubbling and has caramelised evenly, about 15 minutes. Cool before cutting into fingers or squares. Instructions are given in the order in which they are performed (“executed”)
  • 12. Tuesday, March 28, 2023 12 Correct Algorithm? Cut chicken into pieces and brown the pieces on all sides in a casserole dish in hot olive oil. Remove the chicken and to the juices in the casserole add garlic, onions and green peppers, and sauté until onion is golden. Add bay leaf, whole tomatoes, and chicken broth. When the broth boils add salt, saffron and rice. Arrange chicken on rice, cover casserole and bake in a moderate oven (350°F) for 20 minutes or until the rice is tender. Add beans and artichokes during last 10 minutes of cooking.
  • 13. Tuesday, March 28, 2023 13 Cut chicken into pieces and brown the pieces on all sides in a casserole dish in hot olive oil. Remove the chicken and to the juices in the casserole add garlic, onions and green peppers, and sauté until onion is golden. Add bay leaf, whole tomatoes, and chicken broth. When the broth boils add salt, saffron and rice. Arrange chicken on rice, cover casserole and bake in a moderate oven (350°F) for 10 minutes. Add beans and artichokes. Cover, and bake for another 10 minutes or until rice is tender. Correct Algorithm?
  • 14. Tuesday, March 28, 2023 14 From Algorithms to Programs Problem C Program Algorithm: A sequence of instructions describing how to do a task (or process)
  • 15. Tuesday, March 28, 2023 15 Components of an Algorithm  Variables and values  Instructions  Sequences  Procedures  Selections  Repetitions  Documentation
  • 16. Tuesday, March 28, 2023 16 Values  Represent quantities, amounts or measurements  May be numerical or alphabetical (or other things)  Often have a unit related to their purpose  Example:  Recipe ingredients
  • 17. Tuesday, March 28, 2023 17 Variables This jar can contain 10 cookies 50 grams of sugar 3 slices of cake etc. Values Variable  Are containers for values places to store values
  • 18. Tuesday, March 28, 2023 18 Restrictions on Variables  Variables may be restricted to contain a specific type of value
  • 19. Tuesday, March 28, 2023 19 Components of an Algorithm  Values and Variables  Instruction (a.k.a. primitive)  Sequence (of instructions)  Procedure (involving instructions)  Selection (between instructions)  Repetition (of instructions)  Documentation (beside instructions)
  • 20. Tuesday, March 28, 2023 20 Instructions (Primitives)  Some action that is simple...  ...and unambiguous...  ...that the system knows about...  ...and should be able to actually do
  • 21. Tuesday, March 28, 2023 21 Instructions – Examples  Take off your shoes  Count to 10  Cut along dotted line  Knit 1  Purl 2  Pull rip-cord firmly  Sift 10 grams of arsenic Directions to perform specific actions on values and variables.
  • 22. Tuesday, March 28, 2023 22 Instructions -- Application  Some instructions can only be applied to a specific type of values or variables  Examples:
  • 23. Tuesday, March 28, 2023 23 Instructions (Primitives) -- Recommendations  When writing an algorithm, make each instruction simple and unambiguous  Example: Cut chicken into pieces and brown the pieces on all sides in a casserole dish in hot olive oil. Cut chicken into pieces. Heat olive oil in a casserole dish. Brown the chicken pieces in the casserole dish.
  • 24. Tuesday, March 28, 2023 24 Instruction (Primitives)  When writing an algorithm, make the instructions simple and unambiguous.  Example: Cut chicken into pieces and brown the pieces on all sides in a casserole dish in hot olive oil. Cut chicken into pieces. Heat olive oil in a casserole dish. Brown the chicken pieces in the casserole dish. A “sequence” of simple instructions