The Origins of

About This Presentation
Title:

The Origins of

Description:

The Origins of 'Algorithm' The Origins of the Term 'Algorithm' ... Example: Counting names that begin with A' in a list of names. Recap ... – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 14
Provided by: junaidahm

less

Transcript and Presenter's Notes

Title: The Origins of


1
The Origins of Algorithm
2
The Origins of the Term Algorithm
3
Developing Algorithm Using Stepwise Refinement
  • Read the problem statement carefully
  • Rewrite it in your own words if it is not clear
  • Highlight the nouns and look for data items
  • Highlight the verbs to determine the work that
    needs to be done
  • Write the initial algorithm that just describes
    the inputs, outputs and work to be done

4
Stepwise Refinement
  • Now go back to each step in the initial algorithm
    and refine it to describe how it will be
    implemented
  • The Key steps are
  • Rewrite the statement if not clear
  • NounsgtData, VerbsgtAction
  • Initial Algorithm(WHAT)
  • Final Algorithm(HOW)

5
Algorithm Development Exercise
  • Problem 1
  • A Sunoco gas station offers 5 cents per gallon
    discount each Sunday. If a person fills up 20
    gallons every week, how much money will that
    person save in X weeks?

6
Algorithm Development Exercise
  • Problem 2
  • Given the radius of a circle, develop an
    algorithm that computes the area and circumference

7
Algorithm Development Exercise
  • Problem 3
  • Write a cash register algorithm that will compute
    7 percent sales tax at the price of an item and
    then add the tax to the price to obtain the final
    price

8
Properties of Algorithms
  • Simplicity
  • Precision
  • Various Levels of Abstraction

9
Algorithms
  • Algorithms specify the behavior
  • Programs in specific languages just express the
    algorithm in one particular form

10
Information
  • Information means knowledge about something
  • Data is a specific representation of information

11
Components of An Algorithm
  • Data Structures
  • Data Manipulation Instructions
  • Conditional Expressions
  • (if price greater than my_limit then dont buy)
  • Control Structures
  • (while (condition) do statement
  • Modules

12
Levels of Abstraction
  • Details are HIDDEN if we use TOP DOWN approach to
    describe algorithms
  • Example Counting names that begin with A in a
    list of names

13
Recap
  • What is the advantage of hiding details at the
    initial level of algorithm development?
  • What properties of an object must be known to us
    before we can use it?
  • How can we make software reusable?
  • How many types of statements can be part of an
    algorithm?
Write a Comment
User Comments (0)