Contents
Chapter 7 · Data Structure and AlgorithmPractice

LEARN WITH HARU

Video Lesson တွေက Haru အတန်းသားတွေအတွက်ပါ

Haru ရဲ့ ITPEC FE Full Course မှာ ယခု သင်ခန်းစာတွေကို တစ်ခုချင်း တစ်ကြောင်းချင်း အသေးစိတ်ရှင််ရှင်းပြထားပါတယ်

အခြေခံ မရှိတဲ့ ကျောင်းသားများစွာဟာလည်း ဒီ Course နဲ့ ပဲ အောင်မြင်ကုန်ကြပါပြီ

အတန်းမအပ်သေးပဲ Haru ဆီမှာ အစမ်းသင်ကြည့်ချင်ပါသလား?

သင်တန်းသားတွေရဲ့ စကားသံများ

သင်တန်းသားတွေရဲ့ စကားသံများ

Highlighted text? Practice this concept. Highlighted passages and figures open related questions.

Practice related questions (2)Progress & bookmarks

Current section

2-1-2 Three Basic Structures

p. 417

Practice this section 2 linked exam questions with default filters

Progress

Not marked complete

Related questions in this lesson 5

Structured programming with three basic structures1Pre-test and post-test iteration3Terminating conditions in iteration flowcharts1
Progress and bookmarks

p. 417 · PDF 427

2-1-2 Three Basic Structures

Three basic structures are structure units that are used in structured theorem for creating easy-to-understand algorithms that have excellent processing efficiency. (In the structured theorem, if the program has one entry and one exit, it can be represented as a combination of three basic structure units.) When a program is created in consideration of the processing sequence based on the structured theorem, this programming technique is called structured programming. · 1 question

(1) Sequence

“Sequence” is a structure that runs the process in sequence from top to bottom. It is the most basic structure, and other structure units are also combined in “Sequence”.

Figure 7-14  Sequence; original source comparison.
Enlarge original visual
Original source text
Figure 7-14  Sequence 
Source visual description

The original sequence drawing places Process 1, Process 2 and Process 3 in execution order along a downward arrow.

(2) Selection (Decision)

“Selection (Decision)” is a structure that branches the process according to conditions. There is “two-way selection (IF-THEN-ELSE selection)” which branches the process into two according to conditions, and there is “multiple selection (CASE selection)” which branches the process into multiple (usually three or more) paths. (Generally, “Selection” mostly means “IF-THEN-ELSE selection”.) “Two-way selection” executes one of the processes depending on whether the condition is true or false. On the other hand, “CASE selection” executes the process that corresponds to the condition that holds true among multiple conditions. However, in both cases, processes are not simultaneously executed in parallel.

p. 418 · PDF 428

Figure 7-15  IF-THEN-ELSE selection / Figure 7-16  CASE selection; original source comparison.
Enlarge original visual
Original source text
Figure 7-15  IF-THEN-ELSE selection  
Figure 7-16 CASE selection
Source visual description

The original IF-THEN-ELSE flowchart branches from a condition into Process 1 or Process 2 and then rejoins. The original CASE selection flowchart shows three condition branches and three corresponding processes.

(3) Iteration (Loop)

“Iteration (Loop)” is a structure that repeats the process while the condition holds true (or until the condition holds true). In the conditions that are used in “iteration,” the continuing condition continues the iteration process when the condition holds true, and the terminating condition terminates the iteration process as soon as the condition becomes true. In “Iteration”, there is “pre-test iteration (DO-WHILE iteration)” which determines the condition before the iteration process, and there is “post-test iteration (REPEAT-UNTIL iteration)” which determines the condition after the iteration process. “DO-WHILE iteration” may not execute the iteration process even once. However, “REPEAT-UNTIL iteration” executes the iteration process at least once. · 3 questions

Figure 7-17  DO-WHILE iteration / Figure 7-18  REPEAT-UNTIL iteration; original source comparison.
Enlarge original visual
Original source text
Figure 7-17  DO-WHILE iteration 
Figure 7-18 REPEAT-UNTIL iteration
Source visual description

The original DO-WHILE chart places the continuing-condition test before Process 1 and Process 2. The original REPEAT-UNTIL chart places its terminating-condition test after Process 1 and Process 2.

In loop limit symbol, the terminating condition is basically used as the condition of “iteration”. Moreover, other than the terminating condition, changes in the value of a variable can be described in the form “Variable name: Initial value, Increment, Final value”.

p. 419 · PDF 429

Figure 7-19  Iteration by using loop limit symbol; original source comparison.
Enlarge original visual
Original source text
Figure 7-19  Iteration by using loop limit symbol 
Source visual description

The original side-by-side charts show iteration with an explicit condition and with loop-limit symbols, connected by the Same meaning label.

Terminating conditions in iteration flowcharts · 1 practice questions

Three basic structures can be used in any combination. (“Iteration” can be put into the “Selection” process, and “Selection” or “Iteration” can be put into the “Iteration” process.) However, it is better to avoid the nested structure as much as possible where there is “Selection” in the “Selection” process.

Original chapter exercises

Original chapter exercises →

New FE Textbook Vol.1 · IT Fundamentals · First Edition, April 2015