Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Algorithms Vs Meta Language

412 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Algorithms Vs Meta Language

  1. 1. Algorithms vs Syntax Structure Diagrams Kelly Bauer
  2. 2. Algorithms Sequence: <ul><li>BEGIN </li></ul><ul><ul><li>Process 1 </li></ul></ul><ul><ul><li>Process 2 </li></ul></ul><ul><ul><li>Process 3 </li></ul></ul><ul><ul><li>END </li></ul></ul>
  3. 3. Selection: Binary
  4. 4. Selection: Multiple
  5. 5. Repition: Pretest
  6. 6. Repition: Post test
  7. 7. Subprograms All of these examples are published by the BOS in their 1995 book “Methods of Algorithm Description”. This book is great to get, because it includes examples and worked solutions of algorithm problems
  8. 8. Tetris Example <ul><li>BEGIN </li></ul><ul><li>REPEAT </li></ul><ul><li>REPEAT </li></ul><ul><li>Drop Brick </li></ul><ul><li>IF Left OR Right key is pressed THEN </li></ul><ul><li>Rotate piece </li></ul><ul><li>END IF </li></ul><ul><li>IF Space Key is pressed THEN </li></ul><ul><li>Drop brick to bottom </li></ul><ul><li>END IF </li></ul><ul><li>UNTIL brick hits another brick </li></ul><ul><li>IF there are a line of bricks made up </li></ul><ul><li>Remove line of bricks </li></ul><ul><li>Add 1 to score </li></ul><ul><li>Add 1 to speed of bricks </li></ul><ul><li>END IF </li></ul><ul><li>UNTIL bricks hit top of the screen </li></ul><ul><li>Display “End of Game” </li></ul><ul><li>END </li></ul>
  9. 9. So, what is an algorithm?
  10. 10. What’s the difference between an alorithm and a syntax structure diagram?
  11. 11. So, what is a syntax structure diagram?
  12. 12. <ul><li>Dim [Public|Private] <Variable> As <Data Type> </li></ul>Dim Public Private Variable As Data Type
  13. 13. Data Type= [Single|Short|Boolean|Byte|Char|Date|Time|Decimal|Double|Int|Long] Boolean Byte Char Date Time Decimal Double Int Long Short Single
  14. 14. Variable = Uppercase {LowerCase|UpperCase|Digit} Upper Case LowerCase UpperCase Digit
  15. 15. 1 2 3 4 5 6 7 8 9 0 Digit=0|1|2|3|4|5|6|7|8|9
  16. 16. What now? <ul><li>Design an algorithm for your game. </li></ul><ul><li>You also need to do syntax diagrams for all the control structures that you would need in your assignment. The control structures come from your algorithm. </li></ul>

×