Converting flowchart to pseudocode

  • Thread starter Thread starter sandy.bridge
  • Start date Start date
Click For Summary
The discussion revolves around the challenge of converting flowcharts to pseudocode under specific classroom rules. Participants express confusion over the professor's assertion that some flowcharts cannot be represented as pseudocode, despite the general belief that all pseudocode can be illustrated by flowcharts. Key points include the limitations of flowchart rules, such as the number of arrows for actions and conditions, and the implications of these restrictions on pseudocode representation. The conversation also touches on concepts like infinite loops and the absence of certain control structures in pseudocode. Ultimately, the participants seek clarity on how these rules impact the conversion process and the professor's underlying message.
  • #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: 745
  • #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 2 ·
Replies
2
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
22
Views
2K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 20 ·
Replies
20
Views
4K
Replies
8
Views
2K