Sunday, 1 July 2012

flowchart and algorithm

Formal Problem Solving Steps :

• Understand the Problem
• Develop an Algorithm
• Refine the Algorithm
• Create an Action Plan
• Generate a Solution
• Test the Solution

Algorithms:

• Step by step method to solve a problem

• Must include ALL required information

E.G. ~ Recursive Algorithms:

Algorithm Product (a, b)
Recursively find the product of a and b.
if b = 1 then
return a
else
return Product (a, b − 1) + a;
end if
Algorithm Power (a, n)
Compute an, where n is a non-negative integer.
if n = 0 then
return 1
else
return Power (a, n − 1) × a
end if
Algorithm Move (N, source, dest, spare)
Move N disks from peg source to peg dest using peg spare in the Tower of Hanoi puzzle.
if N = 1 then
print “move 1 disk from source to dest”
else
Move (N − 1, source, spare, dest);
print “move 1 disk from source to dest”
Move (N − 1, spare, dest, source);
end


Relational Operators:

• Determine how one value relates to another
– Equal to ==
– Not equal to !=
– Less than <
– Greater than >
– Less than or Equal to <=
– Greater than or Equal to >=

Lamp working testing flow chart :

Follow the Flowchart:

• May have to redraw the flowchart several
times to get it into a form that fits one of the
C structures.
• Rules to Flow charting
– A complex task can be shown as a single block
– Start with the simplest flowchart possible
– Any process can be replaced by a sequence
– Any process can be replaced by a control
structure


Relational Operators:

• Determine how one value relates to another
– Equal to ==
– Not equal to !=
– Less than <
– Greater than >
– Less than or Equal to <=
– Greater than or Equal to >=

Lamp working testing flow chart :


2 comments:

  1. Unquestionably believe that which you stated. Your favorite reason appeared to be on the net the simplest thing to be aware of.
    I say to you, I definitely get irked while people think about worries that they plainly don't know about. You managed to hit the nail upon the top and also defined out the whole thing without having side effect , people can take a signal. Will likely be back to get more. Thanks

    My page ... chinese clothing online free shipping

    ReplyDelete
    Replies
    1. welcome ... friend .. why you not follow this ...

      Delete