SlideShare una empresa de Scribd logo
1 de 20
Algorithm
What is an algorithm?
“A set of rules to be
followed in problem
solving operations.”
or “A Recipe”
Input   Algorithm   Output
Input   Algorithm               Output
        “A set of rules to be
        followed in problem
        solving operations.”
Input                Algorithm               Output
•   2 slices bread
                           “A set of rules to be
•   1 tbsp peanut butter   followed in problem
•   2 tsp strawberry jam   solving operations.”
Input                Algorithm               Output
•   2 slices bread
                           “A set of rules to be
•   1 tbsp peanut butter   followed in problem
•   2 tsp strawberry jam   solving operations.”
Input                Algorithm   Output
•   2 slices bread

•   1 tbsp peanut butter

•   2 tsp strawberry jam
Selena & Michelle’s
  PBJ algorithm
How many steps do you think it will
            take?
There’s more than
 one way to do it.
"""
(C) Gerold Penz)
Python can be simple, too :-)
"""

for quant in range(99, 0, -1):
  if quant > 1:
    print quant, "bottles of beer on the wall,", quant, "bottles of beer."
    if quant > 2:
      suffix = str(quant - 1) + " bottles of beer on the wall."
    else:
      suffix = "1 bottle of beer on the wall."
  elif quant == 1:
    print "1 bottle of beer on the wall, 1 bottle of beer."
    suffix = "no more beer on the wall!"
  print "Take one down, pass it around,", suffix
  print "--"
# (c) Barbara Shaurette

def bottles():
 for i in reversed(range(100)):
  if i > 0:
    b = "bottles"
    if i == 1: b = "bottle"
    print i, b, "of beer on the wall,", 
      i, b, "of beer"
    print "Take one down, pass it around,", 
      i-1, "bottles of beer on the wallnr"

bottles()
Your algorithms
Example: Get from
the airport to home.
“The taxi algorithm”

• Go to the taxi stand.
• Get in a taxi.
• Give the driver my address.
“The call-me
         algorithm”

• When your plane arrives, call my cell
  phone.
• Meet me outside baggage claim.
“The rent-a-car
       algorithm”

• Take the shuttle to the rental car place.
• Rent a car.
• Follow the directions to get to my
  house.
“The bus algorithm”

• Outside baggage claim, catch bus
  number 70.
• Transfer to bus 14 on Main Street.
• Get off on Elm street.
• Walk two blocks north to my house.
All get you to where
  you need to go.

Más contenido relacionado

La actualidad más candente

Operating system
Operating systemOperating system
Operating systemvivek anand
 
Fundamental Programming Lect 1
Fundamental Programming Lect 1Fundamental Programming Lect 1
Fundamental Programming Lect 1Namrah Erum
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & LanguagesGaditek
 
Computer Viruses
Computer VirusesComputer Viruses
Computer VirusesMikaPriya
 
Programming Fundamentals lecture 1
Programming Fundamentals lecture 1Programming Fundamentals lecture 1
Programming Fundamentals lecture 1REHAN IJAZ
 
Operating system.ppt (1)
Operating system.ppt (1)Operating system.ppt (1)
Operating system.ppt (1)Vaibhav Bajaj
 
Operating systems basics (Graphical User Interfaces (GUIs) GUI Tools Applic...
Operating systems basics (Graphical User Interfaces (GUIs)  GUI Tools  Applic...Operating systems basics (Graphical User Interfaces (GUIs)  GUI Tools  Applic...
Operating systems basics (Graphical User Interfaces (GUIs) GUI Tools Applic...Maryam Fida
 
Classification of Computers
Classification of ComputersClassification of Computers
Classification of ComputersHarjinder Singh
 
Units of storage in computer
Units of storage in computerUnits of storage in computer
Units of storage in computerakorede2000
 
Computer maintenance 1 lesson 1
Computer maintenance 1 lesson 1Computer maintenance 1 lesson 1
Computer maintenance 1 lesson 1abbas mohd
 
Ch1 introducing computer systems
Ch1 introducing computer  systemsCh1 introducing computer  systems
Ch1 introducing computer systemscs001
 

La actualidad más candente (20)

Computer Programming
Computer ProgrammingComputer Programming
Computer Programming
 
Introduction To Operating System
Introduction To Operating SystemIntroduction To Operating System
Introduction To Operating System
 
Introduction to software
Introduction to softwareIntroduction to software
Introduction to software
 
Hardware concepts
Hardware conceptsHardware concepts
Hardware concepts
 
Operating system
Operating systemOperating system
Operating system
 
Fundamental Programming Lect 1
Fundamental Programming Lect 1Fundamental Programming Lect 1
Fundamental Programming Lect 1
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
 
Computer Viruses
Computer VirusesComputer Viruses
Computer Viruses
 
Understanding Basics of OS
Understanding Basics of OSUnderstanding Basics of OS
Understanding Basics of OS
 
Programming
ProgrammingProgramming
Programming
 
Programming Fundamentals lecture 1
Programming Fundamentals lecture 1Programming Fundamentals lecture 1
Programming Fundamentals lecture 1
 
Operating system.ppt (1)
Operating system.ppt (1)Operating system.ppt (1)
Operating system.ppt (1)
 
Operating systems basics (Graphical User Interfaces (GUIs) GUI Tools Applic...
Operating systems basics (Graphical User Interfaces (GUIs)  GUI Tools  Applic...Operating systems basics (Graphical User Interfaces (GUIs)  GUI Tools  Applic...
Operating systems basics (Graphical User Interfaces (GUIs) GUI Tools Applic...
 
Classification of Computers
Classification of ComputersClassification of Computers
Classification of Computers
 
Systems analysis and design lecture 1
Systems analysis and design lecture 1Systems analysis and design lecture 1
Systems analysis and design lecture 1
 
Units of storage in computer
Units of storage in computerUnits of storage in computer
Units of storage in computer
 
Computer maintenance 1 lesson 1
Computer maintenance 1 lesson 1Computer maintenance 1 lesson 1
Computer maintenance 1 lesson 1
 
Computer specifications
Computer specificationsComputer specifications
Computer specifications
 
Ch1 introducing computer systems
Ch1 introducing computer  systemsCh1 introducing computer  systems
Ch1 introducing computer systems
 

Destacado

Introduction to Recipes for Agile Governance in the Enterprise (RAGE)
Introduction to Recipes for Agile Governance in the Enterprise (RAGE)Introduction to Recipes for Agile Governance in the Enterprise (RAGE)
Introduction to Recipes for Agile Governance in the Enterprise (RAGE)Cprime
 
Writing Chapters 1, 2, 3 of the Capstone Project Proposal Manuscript
Writing Chapters 1, 2, 3 of the Capstone Project Proposal ManuscriptWriting Chapters 1, 2, 3 of the Capstone Project Proposal Manuscript
Writing Chapters 1, 2, 3 of the Capstone Project Proposal ManuscriptSheryl Satorre
 
O que aconteceu com os mundos virtuais no ensino?
O que aconteceu com os mundos virtuais no ensino?O que aconteceu com os mundos virtuais no ensino?
O que aconteceu com os mundos virtuais no ensino?Neli Maria Mengalli
 
圖說人生哲理
圖說人生哲理圖說人生哲理
圖說人生哲理nonnon
 
Spring 3 - An Introduction
Spring 3 - An IntroductionSpring 3 - An Introduction
Spring 3 - An IntroductionThorsten Kamann
 
Class Project Pxgt 6110
Class Project Pxgt 6110Class Project Pxgt 6110
Class Project Pxgt 6110asmajuhan
 
你的桶子有多滿
你的桶子有多滿你的桶子有多滿
你的桶子有多滿nonnon
 
Baker Wedding Slideshow Review
Baker Wedding Slideshow ReviewBaker Wedding Slideshow Review
Baker Wedding Slideshow Reviewmattwjohnson
 
Even Start Flipbook
Even Start FlipbookEven Start Flipbook
Even Start Flipbookkkibbey
 
Data Mining Protein Structures' Topological Properties to Enhance Contact Ma...
Data Mining Protein Structures' Topological Properties  to Enhance Contact Ma...Data Mining Protein Structures' Topological Properties  to Enhance Contact Ma...
Data Mining Protein Structures' Topological Properties to Enhance Contact Ma...jaumebp
 
Lorelle at WordCamp 2008 - 260 Ways to Break WordPress
Lorelle at WordCamp 2008 - 260 Ways to Break WordPressLorelle at WordCamp 2008 - 260 Ways to Break WordPress
Lorelle at WordCamp 2008 - 260 Ways to Break WordPressLorelle VanFossen
 
La3 Computer Network
La3 Computer NetworkLa3 Computer Network
La3 Computer NetworkCma Mohd
 
Johannes Lars
Johannes LarsJohannes Lars
Johannes Larseka
 

Destacado (20)

Making Software Communities
Making Software CommunitiesMaking Software Communities
Making Software Communities
 
Introduction to Recipes for Agile Governance in the Enterprise (RAGE)
Introduction to Recipes for Agile Governance in the Enterprise (RAGE)Introduction to Recipes for Agile Governance in the Enterprise (RAGE)
Introduction to Recipes for Agile Governance in the Enterprise (RAGE)
 
Writing Chapters 1, 2, 3 of the Capstone Project Proposal Manuscript
Writing Chapters 1, 2, 3 of the Capstone Project Proposal ManuscriptWriting Chapters 1, 2, 3 of the Capstone Project Proposal Manuscript
Writing Chapters 1, 2, 3 of the Capstone Project Proposal Manuscript
 
Flex et Php Afup
Flex et Php AfupFlex et Php Afup
Flex et Php Afup
 
O que aconteceu com os mundos virtuais no ensino?
O que aconteceu com os mundos virtuais no ensino?O que aconteceu com os mundos virtuais no ensino?
O que aconteceu com os mundos virtuais no ensino?
 
Ch01
Ch01Ch01
Ch01
 
圖說人生哲理
圖說人生哲理圖說人生哲理
圖說人生哲理
 
Spring 3 - An Introduction
Spring 3 - An IntroductionSpring 3 - An Introduction
Spring 3 - An Introduction
 
Class Project Pxgt 6110
Class Project Pxgt 6110Class Project Pxgt 6110
Class Project Pxgt 6110
 
你的桶子有多滿
你的桶子有多滿你的桶子有多滿
你的桶子有多滿
 
Baker Wedding Slideshow Review
Baker Wedding Slideshow ReviewBaker Wedding Slideshow Review
Baker Wedding Slideshow Review
 
Even Start Flipbook
Even Start FlipbookEven Start Flipbook
Even Start Flipbook
 
Data Mining Protein Structures' Topological Properties to Enhance Contact Ma...
Data Mining Protein Structures' Topological Properties  to Enhance Contact Ma...Data Mining Protein Structures' Topological Properties  to Enhance Contact Ma...
Data Mining Protein Structures' Topological Properties to Enhance Contact Ma...
 
Lorelle at WordCamp 2008 - 260 Ways to Break WordPress
Lorelle at WordCamp 2008 - 260 Ways to Break WordPressLorelle at WordCamp 2008 - 260 Ways to Break WordPress
Lorelle at WordCamp 2008 - 260 Ways to Break WordPress
 
4 T
4  T4  T
4 T
 
6. open innov conclusions
6. open innov conclusions6. open innov conclusions
6. open innov conclusions
 
La3 Computer Network
La3 Computer NetworkLa3 Computer Network
La3 Computer Network
 
I M S Rubashkin
I M S RubashkinI M S Rubashkin
I M S Rubashkin
 
Johannes Lars
Johannes LarsJohannes Lars
Johannes Lars
 
Hide you file behind a picture
Hide you file behind a pictureHide you file behind a picture
Hide you file behind a picture
 

Más de Selena Deckelmann

While we're here, let's fix computer science education
While we're here, let's fix computer science educationWhile we're here, let's fix computer science education
While we're here, let's fix computer science educationSelena Deckelmann
 
Mistakes were made - LCA 2012
Mistakes were made - LCA 2012Mistakes were made - LCA 2012
Mistakes were made - LCA 2012Selena Deckelmann
 
Postgres needs an aircraft carrier
Postgres needs an aircraft carrierPostgres needs an aircraft carrier
Postgres needs an aircraft carrierSelena Deckelmann
 
Harder, better, faster, stronger: PostgreSQL 9.1
Harder, better, faster, stronger: PostgreSQL 9.1Harder, better, faster, stronger: PostgreSQL 9.1
Harder, better, faster, stronger: PostgreSQL 9.1Selena Deckelmann
 
Letters from the open source trenches - Postgres community
Letters from the open source trenches - Postgres communityLetters from the open source trenches - Postgres community
Letters from the open source trenches - Postgres communitySelena Deckelmann
 
Own it: working with a changing open source community
Own it: working with a changing open source communityOwn it: working with a changing open source community
Own it: working with a changing open source communitySelena Deckelmann
 
Managing terabytes: When Postgres gets big
Managing terabytes: When Postgres gets bigManaging terabytes: When Postgres gets big
Managing terabytes: When Postgres gets bigSelena Deckelmann
 
Managing terabytes: When PostgreSQL gets big
Managing terabytes: When PostgreSQL gets bigManaging terabytes: When PostgreSQL gets big
Managing terabytes: When PostgreSQL gets bigSelena Deckelmann
 
How a bunch of normal people Used Technology To Repair a Rigged Election
How a bunch of normal people Used Technology To Repair a Rigged ElectionHow a bunch of normal people Used Technology To Repair a Rigged Election
How a bunch of normal people Used Technology To Repair a Rigged ElectionSelena Deckelmann
 
Open Source Bridge Opening Day
Open Source Bridge Opening DayOpen Source Bridge Opening Day
Open Source Bridge Opening DaySelena Deckelmann
 
What Assumptions Make: Filesystem I/O from a database perspective
What Assumptions Make: Filesystem I/O from a database perspectiveWhat Assumptions Make: Filesystem I/O from a database perspective
What Assumptions Make: Filesystem I/O from a database perspectiveSelena Deckelmann
 

Más de Selena Deckelmann (20)

While we're here, let's fix computer science education
While we're here, let's fix computer science educationWhile we're here, let's fix computer science education
While we're here, let's fix computer science education
 
Hire the right way
Hire the right wayHire the right way
Hire the right way
 
Mistakes were made - LCA 2012
Mistakes were made - LCA 2012Mistakes were made - LCA 2012
Mistakes were made - LCA 2012
 
Pg92 HA, LCA 2012, Ballarat
Pg92 HA, LCA 2012, BallaratPg92 HA, LCA 2012, Ballarat
Pg92 HA, LCA 2012, Ballarat
 
Managing terabytes
Managing terabytesManaging terabytes
Managing terabytes
 
Mistakes were made
Mistakes were madeMistakes were made
Mistakes were made
 
Postgres needs an aircraft carrier
Postgres needs an aircraft carrierPostgres needs an aircraft carrier
Postgres needs an aircraft carrier
 
Mistakes were made
Mistakes were madeMistakes were made
Mistakes were made
 
Harder, better, faster, stronger: PostgreSQL 9.1
Harder, better, faster, stronger: PostgreSQL 9.1Harder, better, faster, stronger: PostgreSQL 9.1
Harder, better, faster, stronger: PostgreSQL 9.1
 
How to ask for money
How to ask for moneyHow to ask for money
How to ask for money
 
Letters from the open source trenches - Postgres community
Letters from the open source trenches - Postgres communityLetters from the open source trenches - Postgres community
Letters from the open source trenches - Postgres community
 
Own it: working with a changing open source community
Own it: working with a changing open source communityOwn it: working with a changing open source community
Own it: working with a changing open source community
 
Managing terabytes: When Postgres gets big
Managing terabytes: When Postgres gets bigManaging terabytes: When Postgres gets big
Managing terabytes: When Postgres gets big
 
Managing terabytes: When PostgreSQL gets big
Managing terabytes: When PostgreSQL gets bigManaging terabytes: When PostgreSQL gets big
Managing terabytes: When PostgreSQL gets big
 
Pdxpugday2010 pg90
Pdxpugday2010 pg90Pdxpugday2010 pg90
Pdxpugday2010 pg90
 
Illustrated buffer cache
Illustrated buffer cacheIllustrated buffer cache
Illustrated buffer cache
 
Bucardo
BucardoBucardo
Bucardo
 
How a bunch of normal people Used Technology To Repair a Rigged Election
How a bunch of normal people Used Technology To Repair a Rigged ElectionHow a bunch of normal people Used Technology To Repair a Rigged Election
How a bunch of normal people Used Technology To Repair a Rigged Election
 
Open Source Bridge Opening Day
Open Source Bridge Opening DayOpen Source Bridge Opening Day
Open Source Bridge Opening Day
 
What Assumptions Make: Filesystem I/O from a database perspective
What Assumptions Make: Filesystem I/O from a database perspectiveWhat Assumptions Make: Filesystem I/O from a database perspective
What Assumptions Make: Filesystem I/O from a database perspective
 

Último

Regression analysis: Simple Linear Regression Multiple Linear Regression
Regression analysis:  Simple Linear Regression Multiple Linear RegressionRegression analysis:  Simple Linear Regression Multiple Linear Regression
Regression analysis: Simple Linear Regression Multiple Linear RegressionRavindra Nath Shukla
 
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...Lviv Startup Club
 
Grateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfGrateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfPaul Menig
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Dave Litwiller
 
Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Roland Driesen
 
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature SetCreating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature SetDenis Gagné
 
Call Girls in Gomti Nagar - 7388211116 - With room Service
Call Girls in Gomti Nagar - 7388211116  - With room ServiceCall Girls in Gomti Nagar - 7388211116  - With room Service
Call Girls in Gomti Nagar - 7388211116 - With room Servicediscovermytutordmt
 
7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...Paul Menig
 
Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMRavindra Nath Shukla
 
Cash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call GirlsCash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call GirlsApsara Of India
 
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLMONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLSeo
 
Best Basmati Rice Manufacturers in India
Best Basmati Rice Manufacturers in IndiaBest Basmati Rice Manufacturers in India
Best Basmati Rice Manufacturers in IndiaShree Krishna Exports
 
Event mailer assignment progress report .pdf
Event mailer assignment progress report .pdfEvent mailer assignment progress report .pdf
Event mailer assignment progress report .pdftbatkhuu1
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdfRenandantas16
 
The Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case studyThe Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case studyEthan lee
 
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 DelhiCall Girls in Delhi
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesDipal Arora
 
Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageMatteo Carbone
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxAndy Lambert
 

Último (20)

Regression analysis: Simple Linear Regression Multiple Linear Regression
Regression analysis:  Simple Linear Regression Multiple Linear RegressionRegression analysis:  Simple Linear Regression Multiple Linear Regression
Regression analysis: Simple Linear Regression Multiple Linear Regression
 
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...
 
Grateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfGrateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdf
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
 
Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...
 
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature SetCreating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
 
Call Girls in Gomti Nagar - 7388211116 - With room Service
Call Girls in Gomti Nagar - 7388211116  - With room ServiceCall Girls in Gomti Nagar - 7388211116  - With room Service
Call Girls in Gomti Nagar - 7388211116 - With room Service
 
7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...
 
Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSM
 
Cash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call GirlsCash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call Girls
 
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLMONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
 
Best Basmati Rice Manufacturers in India
Best Basmati Rice Manufacturers in IndiaBest Basmati Rice Manufacturers in India
Best Basmati Rice Manufacturers in India
 
Event mailer assignment progress report .pdf
Event mailer assignment progress report .pdfEvent mailer assignment progress report .pdf
Event mailer assignment progress report .pdf
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
 
The Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case studyThe Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case study
 
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
 
Forklift Operations: Safety through Cartoons
Forklift Operations: Safety through CartoonsForklift Operations: Safety through Cartoons
Forklift Operations: Safety through Cartoons
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
 
Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usage
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptx
 

Algorithms are Recipes

  • 2. What is an algorithm?
  • 3. “A set of rules to be followed in problem solving operations.”
  • 5. Input Algorithm Output
  • 6. Input Algorithm Output “A set of rules to be followed in problem solving operations.”
  • 7. Input Algorithm Output • 2 slices bread “A set of rules to be • 1 tbsp peanut butter followed in problem • 2 tsp strawberry jam solving operations.”
  • 8. Input Algorithm Output • 2 slices bread “A set of rules to be • 1 tbsp peanut butter followed in problem • 2 tsp strawberry jam solving operations.”
  • 9. Input Algorithm Output • 2 slices bread • 1 tbsp peanut butter • 2 tsp strawberry jam
  • 10. Selena & Michelle’s PBJ algorithm How many steps do you think it will take?
  • 11. There’s more than one way to do it.
  • 12. """ (C) Gerold Penz) Python can be simple, too :-) """ for quant in range(99, 0, -1): if quant > 1: print quant, "bottles of beer on the wall,", quant, "bottles of beer." if quant > 2: suffix = str(quant - 1) + " bottles of beer on the wall." else: suffix = "1 bottle of beer on the wall." elif quant == 1: print "1 bottle of beer on the wall, 1 bottle of beer." suffix = "no more beer on the wall!" print "Take one down, pass it around,", suffix print "--"
  • 13. # (c) Barbara Shaurette def bottles(): for i in reversed(range(100)): if i > 0: b = "bottles" if i == 1: b = "bottle" print i, b, "of beer on the wall,", i, b, "of beer" print "Take one down, pass it around,", i-1, "bottles of beer on the wallnr" bottles()
  • 15. Example: Get from the airport to home.
  • 16. “The taxi algorithm” • Go to the taxi stand. • Get in a taxi. • Give the driver my address.
  • 17. “The call-me algorithm” • When your plane arrives, call my cell phone. • Meet me outside baggage claim.
  • 18. “The rent-a-car algorithm” • Take the shuttle to the rental car place. • Rent a car. • Follow the directions to get to my house.
  • 19. “The bus algorithm” • Outside baggage claim, catch bus number 70. • Transfer to bus 14 on Main Street. • Get off on Elm street. • Walk two blocks north to my house.
  • 20. All get you to where you need to go.

Notas del editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n