Computers and - PowerPoint PPT Presentation

About This Presentation
Title:

Computers and

Description:

lsp 121 computers and algorithmic processes – PowerPoint PPT presentation

Number of Views:73
Avg rating:3.0/5.0
Slides: 18
Provided by: cwh4
Category:

less

Transcript and Presenter's Notes

Title: Computers and


1
LSP 121
  • Computers and
  • Algorithmic Processes

2
What Is An Algorithmic Process?
  • An ordered series of steps that when applied to a
    problem produces a solution
  • Some call it thinking logically
  • Others refer to it simply as problem solving
  • Often simply called an algorithm

3
Why Should We Know What An Algorithmic Process Is?
  • Many things in life are algorithmic processes
  • Music, dance (such as ballet), art, biology
    (natural selection, nature), math, economics,
    daily living (buying a car or house, career
    changes, college choices)
  • Create useful short programs (called macros) in
    Access, Excel, and Word
  • E.g. Find all the grades for a student, remove
    the lowest homework grade, then calculate the
    average.
  • Write a simple program to analyze data and write
    the next article exposing cheaters in your school
    district (like Freakonomics)

4
Computers and Algorithms
  • Computers are very good at executing algorithms
  • But computers require precise instructions to
    perform an operation
  • This is basically the definition of an algorithm.
    (A series of precise instructions to perform an
    operation.)
  • The instructions cannot be ambiguous (must be
    clear and concise)
  • Lets try an example Begin todays activity

5
What is an Algorithm?
  • Algorithms consist of four basic types of
    operations or instructions
  • 1. Sequential operations, e.g. Add 1 cup of
    butter Subtract the amount of the check from the
    current account balance Set the value of x to 1
  • 2. Conditional operations, e.g. If the mixture is
    too dry, then add ½ cup water If the current
    account balance lt 0, then account overdrawn
  • The if-else statement from todays activity is
    an example of a conditional.

6
What is an Algorithm?
  • 3. Iterative operations, e.g. Repeat the previous
    two steps until the mixture has thickened Repeat
    the following five steps until there are no more
    checks to be processed Repeat steps 1,2 and 3
    until the value of y is equal to 1
  • Looping as seen in todays activity is an
    example of an iterative operation.
  • 4. Calling a pre-existing algorithm (or
    function), e.g. Make a reduction with your sauce
    date getDate()

7
Algorithm to calculate Miles Per Gallon
  • Step 1 Get the values for gallons used, starting
    mileage, ending mileage
  • E.g. Ask the user to type in these values
  • Step 2 Set the value of distance driven to
    ending mileage starting mileage
  • Step 3 Set the value of average miles per gallon
    to distance driven / gallons used
  • Step 4 Print the value of average miles per
    gallon
  • Step 5 Stop

8
Fancier Average Miles Per Gallon
  • Step 1 Get values for gallons used, starting
    mileage, ending mileage
  • Step 2 Set the value of distance driven to
    ending mileage starting mileage
  • Step 3 Set the value of average miles per gallon
    to distance driven / gallons used
  • Step 4 Print the value of average miles per
    gallon (continued on next slide)

9
Modified Average Miles Per Gallon Continued
  • Step 5 If average miles per gallon is greater
    than 25.0 then
  • Print the message You are getting good gas
    mileage!
  • Else
  • Print the message You are NOT getting good gas
    mileage.
  • Step 6 Stop

10
If-Else e.g. Algorithm Inviting Friends to a
Party
  • Step 1 For each of your friends do this loop
  • Step 2
  • If this a close friend then
  • Write an invitation
  • Address an envelope
  • Stick on a stamp
  • Else
  • Put their name on the reserve list
  • Step 3 Check off their name
  • Repeat Steps 2 and 3 until no more friends
  • Step 4 Count number of guests (for food)
  • Step 5 Mail invitations
  • Step 6 Stop

This slide is a demonstration of PESUDOCODE It is
similar to programming statements, but are more
English-like than programming-like.
11
Lets Try Another Example
  • Lets try one together. Write an algorithm (in
    pseudocode) to examine student scores on an
    exam. You want to count how many students passed
    (gt70) and how many students failed (lt70). When
    you hit the end of the list, print the total
    number of students that passed and the total
    number of students that failed.
  • Try next activity Alice

12
Well-Known / Common Algorithms
  • Sorting data
  • Searching for data
  • Routing a packet across the Internet
  • Finding an optimal solution to a problem (such as
    finding the best route on a map using GPS device
    or mapping web site)

13
HTML
  • Hyper-Text Markup Language
  • All web pages are made (to varying degrees) from
    HTML
  • Relatively simple no conditionals (if-else) or
    iterative statements (loops)
  • Each HTML command tells the web browser what to
    do next, such as start a new paragraph, display
    an image, or insert a hyperlink (clickable item)

14
lthtmlgt Begins every HTML document ltheadgt Beg
ins the head section lttitlegtDePaul
University lt/titlegt Title that appears on
browser title bar lt/headgt Ends the head
section ltbodygt Begins the body section This
is the first line.ltbrgt Text followed by line
Break ltpgtStart a new paragraph.lt/pgt Begins a new
paragraph lth1gtFirst Headinglt/h1gt Level 1 heading
(biggest) lth2gtA second level headinglt/h2gt Level 2
heading (little smaller) lthrgt Inserts a
horizontal rule (straight line) ltstronggtThis line
is bold.lt/stronggt Bold text ltbrgt ltemgtThis line is
italicizedlt/emgt Italicized text ltbrgt ltimg
src\images\banner.gifgt Insert an image
here lta hrefhttp//www.cs.depaul.edugt
DePaul CS Pagelt/agt Link to another web
page lt/bodygt Close the body
section lt/htmlgt Ends every HTML document
15
Wanna learn how to create web pages?
  • CDM offers courses that teach you how
  • IT-230 You also learn a little bit of
    programming
  • HCI-201 Uses FrontPage

16
HTML
  • Lets try creating a web page using HTML Activity
    Creating an e-portfolio

17
Last Activities
  • Lets finish our algorithm topic with the
    following activities
  • Creating a Google Mash-up
  • VBA coin toss problem
  • If time permits Google searching techniques
Write a Comment
User Comments (0)
About PowerShow.com