This is not the document you are looking for? Use the search form below to find more!

Report home > Others

Algorithm Designs - Control Structures

0.00 (0 votes)
Document Description
Algorithm Designs Control Structures Stephen Boado 10IST2 There are 3 types of control structures: Sequence Selection Repetition The most common form of control structure. Each step is carried out in…
File Details
  • Added: May, 12th 2011
  • Reads: 220
  • Downloads: 1
  • File size: 29.96kb
  • Pages: 6
  • Tags: structures, designs, control, algorithm
  • content preview
Submitter
  • Name: ufuk
Embed Code:

Add New Comment




Related Documents

Tutorial: Programming in Visual Basic 6.0

by: dutcher, 15 pages

This tutorial contains a beginner’s guide to Visual Basic 6.0, introducing the programming environment, defining key terms and introducing exercises to demonstrate the five control structures ...

Various Applications of Crowd Control Steel Barrier

by: crowdcontrolexpert, 2 pages

Crowd control barriers are available in a wide range of designs, components and sizes. The need for this products spans many industries, including construction, law enforcement and highway and bridge ...

Strawberry Guava (Psidium cattleianum) Prospects for Biological Control

by: shinta, 5 pages

The impacts of seven species of insects that have significant deleterious effects on Psidium cattleianum (Strawberry guava) are presented. A leaf gall produced by Tectococcus ovatus ...

New methods for water pollution control in river basins

by: shinta, 8 pages

Different land use forms (e.g. forestry, agriculture and peat production) affect all levels of river ecosystems through loading of suspended solids, nutrients, metals and acidifying ...

People's Republic of China : Preparing the Songhua River Basin Water Pollution Control and Management Project

by: shinta, 27 pages

During the 2006 Country Programming Review Mission, the Government of the People’s Republic of China (PRC) confirmed the request to the Asian Development Bank (ADB) for technical ...

Water Pollution Prevention and Control - China's Policies and Successful Experiences

by: shinta, 3 pages

The Government of China pays high attention to the prevention and control of water pollution. Ever since 1996, China has designated water pollution prevention as the essential work of ...

DO HIGH JOB DEMANDS INCREASE INTRINSIC MOTIVATION OR FATIGUE OR BOTH ? THE ROLE OF JOB CONTROL AND JOB SOCIAL SUPPORT

by: shinta, 11 pages

In this study, we used Karasek’s demand-control-support model to determine whether either job control or job social support or both can reduce signs of fatigue and simultaneously ...

Decoupling the cost in quantum transition control

by: ouroboros, 3 pages

This is a note about reformulating the cost functional in a quantum transitional control problem so as to decouple the problem in time.

The functional design of depression's influence on attention: A preliminary test of alternative control-process mechanisms

by: shinta, 21 pages

Substantial evidence indicates that depression focuses attention on the problems that caused the episode, so much that it interferes with the ability to focus on other things. We hypothesized that ...

Testing Predictions from the Hunter-Gatherer Hypothesis - 1: Sex Differences in the Motor Control of Hand and Arm

by: shinta, 13 pages

Here, in the first of two reports that test predictions from the hunter-gatherer hypothesis, we focus on sex differences in motor control. Published evidence confounds the cognitive demands, the ...

Content Preview
  1. Algorithm Designs Control Structures Stephen Boado 10IST2
    • There are 3 types of control structures:
    • Sequence
    • Selection
    • Repetition
    • The most common form of control structure.
    • Each step is carried out in order of their position and is only done once.
    • In pseudocode, it always starts with ‘Begin’, then the steps are listed out and ends in ‘End’.
    • In flowchart, it begins with a (terminator), then the steps are shown by (process) and ends with another terminator.
    Sequence Pseudocode BEGIN Get 2 numbers Store in num1 & num2 Calculate sum (num1 + num2) Output sum END Flowchart Begin Fill a kettle with water Boil the water in the kettle Put tea leaves in the pot Pour boiling water into the pot End
  2. Selection
    • Allows a choice to be made in an algorithm.
    • Decides a particular answer from a set of variable answers and carries out the steps that proceeds it.
    • In flowchart, the query/ dicussion / problem is represented by and the choices as a process.
    • There are two types of selection control structures: 1) binary selection 2) case selection (also called multiple selection) .
    • Binary selection is where there are two possible choices to choose. Binary uses IF ... ELSE ... ENDIF. If the condition is met (true) then one path is taken, otherwise (false) the other path is taken.
    Pseudocode IF the telephone rings THEN Answer the phone ELSE Continue reading ENDIF Flowchart Telephone rings? Continue reading Answer phone F T
    • Case selection is where there is more than one possible choices to choose when trying to solve the problem. Only one process can be carried out. Case selection uses CASE ... ENDCASE.
    • The condition is checked and if the first choice is true then it is carried out. If the first choice is false, then the second will be checked. If it’s true then it is carried out. If no choice is found to be true then the otherwise choice will be carried out.
    Pseudocode CASEWHERE traffic light is Red: Stop vehicle Green: Drive through intersection OTHERWISE: Slow down and prepare to stop ENDCASE Flowchart Signal? Stop Drive Slow and stop Red Green Otherwise
  3. Repetition
    • Carries out a particular action over and over again until the condition is met.
    • A loop is created to return the program to where the repetition has started for as long as it takes until the condition is met.
    • There are two ways of testing to see if the end condition is met: 1) pre-test loops 2) post-test loops.
    • In pre-test loops the condition is tested at the start. If the condition is false the first time, the processes will never carry out. Pre-test loops end when the condition Is false. Uses WHILE … ENDWHILE.
    • Counted loops are special types of pre-test loops. They are used when a known number of repetitions will occur.
    • Pre-test loops are also known as guarded loops because the loop is only operated when the condition is met.
    Pseudocode WHILE there is pressure on the mat Sound the bell ENDWHILE Flowchart Pressure on mat? Sound bell T F
    • Post-test loops tests the condition at the end of the loop. Uses REPEAT … UNTIL.
    • The process in the loop is executed first whether it is true or false and will keep repeating until the condition is met.
    • Post-test loops end when the condition is true but the loop always do the loop at least once, even if the end condition is originally true.
    • Post-test loops are also called unguarded loops because no check is made before the algorithm begins the loop structure.
    Pseudocode REPEAT Take out one item UNTIL bag is empty Is bag empty? Flowchart Take out item T F

Download
Algorithm Designs - Control Structures

 

 

Your download will begin in a moment.
If it doesn't, click here to try again.

Share Algorithm Designs - Control Structures to:

Insert your wordpress URL:

example:

http://myblog.wordpress.com/
or
http://myblog.com/

Share Algorithm Designs - Control Structures as:

From:

To:

Share Algorithm Designs - Control Structures.

Enter two words as shown below. If you cannot read the words, click the refresh icon.

loading

Share Algorithm Designs - Control Structures as:

Copy html code above and paste to your web page.

loading