You can call them N-S Diagrams if you’d like
Intro…
 There are many different ways of describing an
algorithm in the Design phase:
 NS Diagrams
 Flowcharts
 Pseudo...
Algorithm design
 Any algorithm should be able to be constructed using
one or more of the 4 main parts of an algorithm:
...
Process blocks
 A process block is used to represent a single action
 An algorithm is composed of steps or primitives.
...
Conditional: 2 way branch
 Used to represent a condition leading to two possible
actions (also known as a Boolean)
 A br...
Conditional: multiple branches
 A multiple branching block is used when there are
several alternative actions:
 E.g.:
Iteration: Test first loop
 A test first loop block is used when a set
of actions are to be repeated under a
particular c...
Examples of test first loop
 Conditional iteration:
 A counted loop is also a test first loop –
repeating the actions a ...
Iteration: Test Last loop
 A test last loop is used when a process is repeated
under a particular condition.
 The condit...
Example of test last block
 These repeated actions are tested at
the end of the loop.
 E.g. making a pancake mix:
 The ...
Modules: sub process blocks
 A sub process block or module is
used in instances where the
process is large enough to
warr...
Some questions:
1. Complete
a. Why are N-S diagrams used when designing
algorithms?
b. What are some other algorithm desig...
More questions:
 Follow the instructions :
A practical (sort of) example:
Now your turn!
1. Go to taste.com.au
2. Find an awesome, tasty looking recipe
3. Turn it into an NS Diagram
4. Make it
5. ...
Nassi Shneiderman Diagrams: Algorithms Made Easier (at least a little bit)
of 16

Nassi Shneiderman Diagrams: Algorithms Made Easier (at least a little bit)

NS Diagrams are a graphical way of representing algorithms, allowing you to quickly and easily see if your algorithm will work prior to programming. They're a bit like Lego for algorithms
Published on: Mar 3, 2016
Published in: Business      
Source: www.slideshare.net


Transcripts - Nassi Shneiderman Diagrams: Algorithms Made Easier (at least a little bit)

  • 1. You can call them N-S Diagrams if you’d like
  • 2. Intro…  There are many different ways of describing an algorithm in the Design phase:  NS Diagrams  Flowcharts  Pseudo code  …  NS Diagrams are useful for encouraging some aspects of structured programming techniques.  NS Diagrams are noticeable by their ‘building blocks’ form, of which there are 4 main types..
  • 3. Algorithm design  Any algorithm should be able to be constructed using one or more of the 4 main parts of an algorithm:  Process – a single step  Conditional – dependant upon choice  Iteration – loop until a condition is met  Module - a grouping of the above which can be referenced multiple times, from multiple places.
  • 4. Process blocks  A process block is used to represent a single action  An algorithm is composed of steps or primitives.  E.g.:  Or multiple together: Process (single step) Get an egg Get an egg Crack the egg
  • 5. Conditional: 2 way branch  Used to represent a condition leading to two possible actions (also known as a Boolean)  A branching action is represented by two blocks side by side meaning: perform the action on the left if the condition is true, or else perform the action on the right if the condition is false.  E.g.:
  • 6. Conditional: multiple branches  A multiple branching block is used when there are several alternative actions:  E.g.:
  • 7. Iteration: Test first loop  A test first loop block is used when a set of actions are to be repeated under a particular condition.  The condition is tested first  Repeated action is represented by a block within a block, meaning repeat the action under the conditions stated  Because a test first loop is tested before any actions it is possible that no actions take place.
  • 8. Examples of test first loop  Conditional iteration:  A counted loop is also a test first loop – repeating the actions a set number of times and are counted before taking place.  NOTE: the counting starts before the loop begins. ‘1’ happens before any eggs are broken in.
  • 9. Iteration: Test Last loop  A test last loop is used when a process is repeated under a particular condition.  The condition is tested last
  • 10. Example of test last block  These repeated actions are tested at the end of the loop.  E.g. making a pancake mix:  The actions in a test last loop are always carried out at least once because the test occurs after the actions have occurred. So a little milk will always be added and stirred.
  • 11. Modules: sub process blocks  A sub process block or module is used in instances where the process is large enough to warrant a separate design or where the process is used several times in the same diagram.
  • 12. Some questions: 1. Complete a. Why are N-S diagrams used when designing algorithms? b. What are some other algorithm design tools? 2. What is being tested in test first and test last loops? 3. Express this part of an N-S diagram in words:
  • 13. More questions:  Follow the instructions :
  • 14. A practical (sort of) example:
  • 15. Now your turn! 1. Go to taste.com.au 2. Find an awesome, tasty looking recipe 3. Turn it into an NS Diagram 4. Make it 5. Bring it to school 6. Group evaluation!!!! 

Related Documents