SlideShare a Scribd company logo
1 of 19
RECOGNIZING
STRUCTURES
Recognizing Structures
 When you are beginning to learn about
structured program design, it is difficult to
detect whether a flowchart of a program’s logic
is structured.
 In recognizing structure, the three basic
structures must be taken into consideration.
 By recognizing its structure we can identify if
there are tangled or unstructured flowchart
segments.
Example 1:
 Does the flowchart
segment
structured?
 How many
structures does
the flowchart
segment have?
 What structures do
you recognize
from the flowchart
segment?
Sequence
Selection
Figure 1
Example 2:
 Does the flowchart
segment
structured?
 How many
structures does
the flowchart
segment have?
 What structures do
you recognize
from the flowchart
segment?
Loop
Selection
Figure 2
Example 3:
 Does the
flowchart
segment
structured?
 No, it is not built
from the three
basic structures.
Figure 3
This part of
the segment
is not
structured
Spaghetti Bowl Method
 One way to straighten out an unstructured
flowchart segment is to use the “spaghetti
bowl” method.
 That is, picture the flowchart as a bowl of
spaghetti that you must untangle. Imagine you
can grab one piece of pasta at the top of the
bowl and start pulling. As you “pull” each
symbol out of the tangled mess, you can
untangle the separate paths until the entire
segment is structured.
Spaghetti Bowl Method (cont’d.)
 Use the Spaghetti Bowl Method to structure
the flowchart segment
 Start pulling at Figure 3 top
 Encounter procedure box Labeled A (Figure 3-1)
Figure 3-1 Untangling Example 3, first step
Spaghetti Bowl Method (cont’d.)
 Next item is a question
 Testing condition labeled B (Figure 3-2)
 Now know sequence starting with A ended
Figure 3-2 Untangling Example 3, second step
Spaghetti Bowl Method (cont’d.)
 Pull flowline from “No” side of Question B
 Encounter C (Figure 3-3)
Figure 3-3 Untangling Example 3, third step
Spaghetti Bowl Method (cont’d.)
 Pull flowline from “Yes” side of Question B
 Encounter D (Figure 3-4)
Figure 3-4 Untangling Example 3, fourth step
Spaghetti Bowl Method (cont’d.)
 Follow line on left side of Question D
 If line attached somewhere, untangle by repeating
tangled step
 Continue pulling flowline emerging from Step
C
 Reach end of program segment (Figure 3-5)
Figure 3-5 Untangling Example 3, fifth step
Spaghetti Bowl Method (cont’d.)
 Pull right side of Question D
 Process E pops up (Figure 2-6)
 Reached the end
Figure 2-6 Untangling Example 3, sixth step
Spaghetti Bowl Method (cont’d.)
 Question D brought together: selection
structure
 Question B loose ends brought together:
selection structure
Figure 3 Finished flowchart and
pseudo code for untangling
Example 3
Describing Three Special
Structures –
Case, While and Do-Until
 Three more forms of basic structures
 Case
 Alternative decision-making structure
 Do-while
 Alternative to while loop
 Do-until loops
 Alternative to while loop
 Sometimes convenient
 All acceptable, legal structures
The Case Structure
 Several possible values exists for single
variable being tested
 Each value requires different course of action
 Flow passes through only one alternative
 Flowchart, pseudo code, program code
convenience
 Easier to understand at first glance
 Examples
 Figure 4-1: series of decisions
 Figure 4-2: case structure implementing decisions
The Case Structure (cont’d.)
Figure 4-1 Flowchart and pseudo code of tuition
decisions
The Case Structure (cont’d.)
Figure 4-2 Flowchart
and pseudo code of
case structure
The While Loop
 while loop
 Condition tested at structure beginning
 Condition not met at first test
 Code in while structure body never executed
 Also called a pretest loop
Figure 4-3 The while loop
The Do-While or Do-Until Loops
 do-while loop
 Condition tested at structure end
 Body has executed at least once
 Expressed as a sequence followed by a loop
 Also called a posttest loop
Figure 4-4 The do-while or do-until loop

More Related Content

More from MattFlordeliza1 (8)

web host used tsu lecture reliable for other .pptx
web host used tsu lecture reliable for other .pptxweb host used tsu lecture reliable for other .pptx
web host used tsu lecture reliable for other .pptx
 
bootstrap 4 used for discussion in chcci.pptx
bootstrap 4 used for discussion in chcci.pptxbootstrap 4 used for discussion in chcci.pptx
bootstrap 4 used for discussion in chcci.pptx
 
JDBC OVERVIEW uses from the subject of EDP.pptx
JDBC OVERVIEW uses from the subject of EDP.pptxJDBC OVERVIEW uses from the subject of EDP.pptx
JDBC OVERVIEW uses from the subject of EDP.pptx
 
ACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptxACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptx
 
PLF-Lesson tsu lecture time 2 units-2.pptx
PLF-Lesson tsu lecture time 2 units-2.pptxPLF-Lesson tsu lecture time 2 units-2.pptx
PLF-Lesson tsu lecture time 2 units-2.pptx
 
Psuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptxPsuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptx
 
www module 1.pptx
www module 1.pptxwww module 1.pptx
www module 1.pptx
 
QUEUE.pptx
QUEUE.pptxQUEUE.pptx
QUEUE.pptx
 

Recently uploaded

( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
nilamkumrai
 
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
nilamkumrai
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
imonikaupta
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 

Recently uploaded (20)

Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 

PLF-Lesson-5 programming in TSU lec.pptx

  • 2. Recognizing Structures  When you are beginning to learn about structured program design, it is difficult to detect whether a flowchart of a program’s logic is structured.  In recognizing structure, the three basic structures must be taken into consideration.  By recognizing its structure we can identify if there are tangled or unstructured flowchart segments.
  • 3. Example 1:  Does the flowchart segment structured?  How many structures does the flowchart segment have?  What structures do you recognize from the flowchart segment? Sequence Selection Figure 1
  • 4. Example 2:  Does the flowchart segment structured?  How many structures does the flowchart segment have?  What structures do you recognize from the flowchart segment? Loop Selection Figure 2
  • 5. Example 3:  Does the flowchart segment structured?  No, it is not built from the three basic structures. Figure 3 This part of the segment is not structured
  • 6. Spaghetti Bowl Method  One way to straighten out an unstructured flowchart segment is to use the “spaghetti bowl” method.  That is, picture the flowchart as a bowl of spaghetti that you must untangle. Imagine you can grab one piece of pasta at the top of the bowl and start pulling. As you “pull” each symbol out of the tangled mess, you can untangle the separate paths until the entire segment is structured.
  • 7. Spaghetti Bowl Method (cont’d.)  Use the Spaghetti Bowl Method to structure the flowchart segment  Start pulling at Figure 3 top  Encounter procedure box Labeled A (Figure 3-1) Figure 3-1 Untangling Example 3, first step
  • 8. Spaghetti Bowl Method (cont’d.)  Next item is a question  Testing condition labeled B (Figure 3-2)  Now know sequence starting with A ended Figure 3-2 Untangling Example 3, second step
  • 9. Spaghetti Bowl Method (cont’d.)  Pull flowline from “No” side of Question B  Encounter C (Figure 3-3) Figure 3-3 Untangling Example 3, third step
  • 10. Spaghetti Bowl Method (cont’d.)  Pull flowline from “Yes” side of Question B  Encounter D (Figure 3-4) Figure 3-4 Untangling Example 3, fourth step
  • 11. Spaghetti Bowl Method (cont’d.)  Follow line on left side of Question D  If line attached somewhere, untangle by repeating tangled step  Continue pulling flowline emerging from Step C  Reach end of program segment (Figure 3-5) Figure 3-5 Untangling Example 3, fifth step
  • 12. Spaghetti Bowl Method (cont’d.)  Pull right side of Question D  Process E pops up (Figure 2-6)  Reached the end Figure 2-6 Untangling Example 3, sixth step
  • 13. Spaghetti Bowl Method (cont’d.)  Question D brought together: selection structure  Question B loose ends brought together: selection structure Figure 3 Finished flowchart and pseudo code for untangling Example 3
  • 14. Describing Three Special Structures – Case, While and Do-Until  Three more forms of basic structures  Case  Alternative decision-making structure  Do-while  Alternative to while loop  Do-until loops  Alternative to while loop  Sometimes convenient  All acceptable, legal structures
  • 15. The Case Structure  Several possible values exists for single variable being tested  Each value requires different course of action  Flow passes through only one alternative  Flowchart, pseudo code, program code convenience  Easier to understand at first glance  Examples  Figure 4-1: series of decisions  Figure 4-2: case structure implementing decisions
  • 16. The Case Structure (cont’d.) Figure 4-1 Flowchart and pseudo code of tuition decisions
  • 17. The Case Structure (cont’d.) Figure 4-2 Flowchart and pseudo code of case structure
  • 18. The While Loop  while loop  Condition tested at structure beginning  Condition not met at first test  Code in while structure body never executed  Also called a pretest loop Figure 4-3 The while loop
  • 19. The Do-While or Do-Until Loops  do-while loop  Condition tested at structure end  Body has executed at least once  Expressed as a sequence followed by a loop  Also called a posttest loop Figure 4-4 The do-while or do-until loop

Editor's Notes

  1. Yes it is structured.. 2 structures Sequence and Selection NOTE: notice that the segment has only one entry point and exit point.
  2. Yes it is structured.. 2 structures Loop and a Selection within the Loop NOTE: notice that the segment has only one entry point and exit point.