cs 498 242 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
CS 498 (242) PowerPoint Presentation
Download Presentation
CS 498 (242)

Loading in 2 Seconds...

play fullscreen
1 / 19

CS 498 (242) - PowerPoint PPT Presentation


  • 60 Views
  • Uploaded on

CS 498 (242). Lecture 3. Last Lecture. Made too many assumptions Was too broad Did not cover timing in enough detail to be useful Did not cover important parts of optimization in enough detail. Important Points. Optimization priorities: Improve the algorithm if you can

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'CS 498 (242)' - silas-bradshaw


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
cs 498 242

CS 498 (242)

Lecture 3

last lecture
Last Lecture
  • Made too many assumptions
  • Was too broad
  • Did not cover timing in enough detail to be useful
  • Did not cover important parts of optimization in enough detail
important points
Important Points
  • Optimization priorities:
    • Improve the algorithm if you can
    • Concentrate your effort on the code that is executed most (it was obvious in last assignment)
    • Eliminate unnecessary instructions (things that don’t change from one iteration to next)
    • Order conditionals so those most likely to fail come first
slide4
FSM
  • Example - Vending machine
    • Accepts nickels only
    • $0.15 dispense product
pseudo code
Pseudo-code

While machine on

inputTotal = 0

While (inputTotal < PRODUCT_PRICE)

inputTotal += AcceptCoin(coin)

DispenseProduct

acceptcoin coin
AcceptCoin(coin)
  • Is it a nickel?
    • Yes – return(5)
  • RejectCoin(coin)
  • Return(0)
acceptcoin coin1
AcceptCoin(coin)
  • Is it a nickel?
    • Yes – return(5)
  • Is it a dime?
    • Yes – return(10)
  • Is it a quarter?
    • Yes – return(25)
  • RejectCoin(coin)
  • Return(0)
outline
Outline

Introduction

I have a couple of points to make

Topic 1

key point 1

first detail of my first point

second detail of my first point

second key point

Conclusion

tree data structure
Tree Data Structure
  • Root node (outline)
  • Children:
    • Introduction
    • Topic(s)
    • Conclusion
tree data structure1
Tree Data Structure
  • Topic(s)
    • Key point(s)
      • Detail(s)
tree data structure2
Tree Data Structure
  • Key point(s)
    • Detail(s)
example
Example

<outline>

<outlinename>My Outline</outlinename>

<introduction>I have a couple of points to make</introduction>

<topic>

<topicname>Topic 1</topicname>

<keypoint>

<keypointtitle>key point 1(/keypointtitle> <detail>first detail of my first point</detail>

<detail>second detail of my first point</detail>

</keypoint>

<keypoint><keypointtitle>second key point</keypointtitle>

</keypoint>

</topic>

</outline>

what signals you to exit a state1
What signals you to exit a state?
  • Matching end tag
  • Example - </topic>
topic
<topic>
  • Get next tag
  • Is it:
    • Topicname
    • Keypoint
    • </topic>

We don’t worry if it’s a “<conclusion>” or anything else. Those are not valid inputs to transition states.