Learning about NS graphs

NS plots are also known as box plots or CHAPIN plots. In 1973, American scholars I.Nassi and B.Shneiderman proposed a flow chart form in which the flow line is completely removed from the flow chart, and all algorithms are written in a rectangular array, and other boxes can also be included in the frame. That is, a large frame is composed of some basic frames. This kind of flow chart is also called NS structure flow chart (composed of the first letter of the names of two people). NS graph includes three basic structures of sequence, selection and cycle. NS diagrams are similar to flowcharts, but the difference is that NS diagrams can represent the structure of a program.

Features:

1) The NS diagram is intuitive, with clear functional domains and good visibility;

2) It is easy to determine the scope of local and global data;

3) It is impossible to transfer control arbitrarily;

4) It is easy to express the nesting relationship and the hierarchical relationship of modules;

5) The complexity is close to the code itself, and modification requires redrawing the entire graph;

6) It forces the designer to think and describe his design scheme according to the SP method, because it no longer provides other description means except for the symbols representing several standard structures, which effectively guarantees the quality of the design, thereby also The quality of the program is guaranteed.

The following is an example of my learning NS structure flow chart.

As for the drawing tool, I used the drawing tool that comes with the computer directly at the beginning, and then Visio

1. Print out all prime numbers from 1-n

4fe6dc23338749669a9bb28d3fa452b0.png

2. Judgment of palindrome: Given a 5-digit number, judge whether it is a palindrome.

e432b23b641744468fb9d144d1d732dc.png

 3. Piecewise function calculation

420a74fe70074d39a5de5cc11437021f.png

 4. Enter a line of characters, and count the number of English letters, spaces, numbers and other characters.

1f4b9794c42d4e04bf7a71a5d7cb2e55.png

 5.

37afbbcdec824d88a94db80e8903c41c.png

6.

3fed3d1cd3c54df1a340d1df04e5f77e.png

7.

1d905db88ebe4ed9bfe84cec622af577.png 

 

 

 

Guess you like

Origin blog.csdn.net/weixin_74287172/article/details/130160389