Converting flowchart to pseudocode

  • Thread starter Thread starter sandy.bridge
  • Start date Start date
Click For Summary
SUMMARY

The discussion centers on the conversion of flowcharts to pseudocode, specifically addressing the constraints imposed by a professor's rules. Participants agree that while pseudocode can represent any flowchart, certain flowcharts may not be convertible to pseudocode under specific restrictions, such as limitations on choice branches and atomic actions. The conversation highlights the implications of the Böhm-Jacopini theorem, which states that any algorithm can be expressed using sequence, selection, and iteration, but restrictions can lead to scenarios where flowcharts exceed the capabilities of the allowed pseudocode constructs. The role of atomic actions, interrupts, and exceptions in this context is also examined.

PREREQUISITES
  • Understanding of flowchart symbols and their meanings, including atomic actions, decision diamonds, and start/stop ovals.
  • Familiarity with pseudocode concepts and structures, particularly in the context of algorithm representation.
  • Knowledge of the Böhm-Jacopini theorem and its implications for algorithm design.
  • Basic programming concepts in C++, including control structures like loops and conditionals.
NEXT STEPS
  • Research the Böhm-Jacopini theorem and its relevance to flowchart and pseudocode conversion.
  • Explore the limitations of pseudocode in representing complex flowchart structures, particularly regarding choice branches.
  • Learn about flowcharting tools like AllClear and their capabilities in generating flowcharts from pseudocode.
  • Investigate the role of interrupts and exceptions in programming and how they affect flowchart design.
USEFUL FOR

This discussion is beneficial for computer science students, particularly those learning about algorithm representation, flowchart design, and pseudocode. It is also relevant for educators seeking to clarify the relationship between flowcharts and pseudocode in instructional settings.

  • #61
Don't leave it empty put in your best guess, you may be right (maybe the prof is searching for the answer to the conundrum himself and waiting for that one special chosen student)

You can't win if you don't play.
 
Physics news on Phys.org
  • #62
sandy.bridge said:
Since pseudo-code is supposed to evaluate each of its actions one at a time, what if we did the following? There is nothing in the flow chart that indicates which of the atomic actions it is supposed to evaluate first, and hence we would not be able to represent it in pseudo-code unless it was actually specified.

I thought "bullets" could only have one arrow out?
 
  • #63
Yeah, you're right.
 
  • #64
In case you're interested, the solution was merely two flows meeting up at a bullet, and then going into an atomic action.
 
  • #65
sandy.bridge said:
In case you're interested, the solution was merely two flows meeting up at a bullet, and then going into an atomic action.

:confused: But with only one START allowed, where does the second flow come from? That's what we were trying so hard to gimmick up with the phantom threads created by the dangling decision blocks... Hmph.
 
  • #66
sandy.bridge said:
In case you're interested, the solution was merely two flows meeting up at a bullet, and then going into an atomic action.
Two flows or two paths, of which only one can be taken at a time? If it's two paths, then this is the same as pseudocode containing two or more branches to the same label.
 
Last edited:
  • #67
sandy.bridge said:
In case you're interested, the solution was merely two flows meeting up at a bullet, and then going into an atomic action.

Professorial fail. That's easy to represent in pseudocode and a common requirement.

I don't suppose you have a diagram of this so-called impossible flowchart.
 
  • #68
Here:
 

Attachments

  • q5_soln2.png
    q5_soln2.png
    4.8 KB · Views: 754
  • #69
But that's trivially implemented in any pseudo code that isn't deliberately hobbled by fanatical style rules.
 
  • #70
FirstTest: If not wantBanana then goto SecondTest
selectFruitFromBunch
Enjoy: peelAndEatFruit
goto FirstTest
SecondTest: if wantOrange then goto Enjoy
Stop
 

Similar threads

Replies
9
Views
9K
  • · Replies 20 ·
Replies
20
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
22
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K