|
.
NETWORK
FOLLOW ME
your follower gadget here! max.width :350px!
|
RECENT STORIES
|
MONTHLY ARCHIVE
|
BLOGLOVIES
|
8.2.2 ALGORITHM
Sunday, 20 March 2016 at 23:28
# The algorithm is the abstract idea of solving a problem.
# An algorithm is a step-by-step instructions that will transform the input into the output.
# It can be represent using pseudocode or flow chart.
It can be described using three control structures (Bohm and Jacopini-1966);
1. A sequence;
- is a series os statements that execute one after another.
2. A selection;
- statement is used to determine which of two different statements to execute depending on certain conditions.
3. A looping;
- a repetition.
0 Comments:
|
8.2.2 ALGORITHM
Sunday, 20 March 2016 at 23:28
# The algorithm is the abstract idea of solving a problem.
# An algorithm is a step-by-step instructions that will transform the input into the output.
# It can be represent using pseudocode or flow chart.
It can be described using three control structures (Bohm and Jacopini-1966);
1. A sequence;
- is a series os statements that execute one after another.
2. A selection;
- statement is used to determine which of two different statements to execute depending on certain conditions.
3. A looping;
- a repetition.
0 Comments:
|
ALL ABOUT ME
This is my page, I can write what I want
HEY IM AINUR AND IM A COMPUTER SCIENCE STUDENT IN PAHANG MATRICULATION COLLEGE. COMPUTER SCIENCE IS AWESOME!! COOL KIDS LEARN COMPUTER SCIENCE AND WE WILL RULE THE WORLD WITH OUR CREATIVITY AND OUR BIG BRILLIANT BRAIN.
your all about me here
|
link1
anything you want to say here
8.2.2 ALGORITHM
# The algorithm is the abstract idea of solving a problem.
# An algorithm is a step-by-step instructions that will transform the input into the output.
# It can be represent using pseudocode or flow chart.
It can be described using three control structures (Bohm and Jacopini-1966);
1. A sequence;
- is a series os statements that execute one after another.
2. A selection;
- statement is used to determine which of two different statements to execute
depending on certain conditions.
3. A looping;
- a repetition.
|
link2
anything you want to say here
8.2.3 PSEUDOCODE
Technique to represent the Algorithm:
1. Pseudocode;
~ Artificial, informal language used to develop algorithms.
~ Similar to everyday English.
2. Flow chart;
~ Graphical representation of an algorithm.
~ Special-purpose symbols connected by arrows (flow lines).
|
link3
anything you want to say here
8.2.4 FLOW CHART
1. Flow chart- symbols
2. Flow chart
|
link4
anything you want to say here
8.2.5 CONTROL STRUCTURE
8.2.5.1 Sequence
The simplest programs consist just sequence of statements:
- no loops, no selections amongst alternative actions, no use of subroutines.
# Instructions in sequence programming are executed sequentially one by one.
# The sequence structure directs the computer to process the instructions, one
after another, in the order listed in program.
first instruction ---> last instruction
|
link5
anything you want to say here
8.2.5.2 Selection
What is selection structure?
~ The selection structure allows instructions to be executed non-sequentially.
~ It allows the comparison of two expressions and based on the comparison, to select certain course of action.
Types of selection structure:
1. if-else (two way selection)
2. nested if-else ( multi-way selection)
3. switch (multi-way selection)
Selection --> (1) if-else;
~ In this form, the expression is first evaluated.
~ If it evaluates to non-zero (TRUE), statement_1 is executed.
~ Otherwise, statement_2 is excuted.
~ Either statement_1 or statement_2 is executed but NOT BOTH.
Selection --> (2) nested if-else;
~ Expression_1 is evaluated. If it evaluates to non-zero (TRUE), statement_1 is executed.
~ If not, control goes to the second if, where expression_2 is evaluated. If it evaluates to non-zero (TRUE), statement_2 is executed.
~ If not control goes to third if, where expression_3 is evaluated. If it evaluates to non-zero (TRUE), statement_3 is executed.
~ If not, statement_4 is executed.
~ Rules -> only one of the statement is executed.
Selection --> (3) switch;
~ Switch evaluates expression and checks if it is equivalent to constant1,
- if it is, it executes group of statement1 until it finds the break statement.
~ If expression was not equal to constant1 it will be checked against constant2,
- if it is equal to this, it will execute statement2.
~ If the value of expression DID NOT match any of the previously specified constants, the program will execute the statements included after the default.
|
LINK6
anything you want to say here
8.2.5.3 Looping
What is looping structure?
~ The looping structure allows a sequence of instructions to be executed repeatedly until a certain condition is reached.
~ The looping structure has three forms:
- while
- do..while
- for
Looping --> (1) while construct;
~ where the expression is first evaluated.
~ if it is true (not zero), the statement(s) is executed.
~ else if it false (zero), the statement is bypassed.
Looping --> (2) do..while construct;
~ where the expression is last evaluated, after the statement(s) is executed.
~ this means the statement(s) in the do..while will be executed at least once.
Looping --> (3) for construct;
~ where the initialization refers to the initial value of a loop counter.
~ the expression determines whether the loop should be continued; if it is true (not zero), the statement(s) is excuted, else if it false (zero), the for loop is terminated.
~ the incrementation increments the loop counter.
|
Post a Comment