Reflection Week 6 Algorithms and Programming (Recursive)

At the sixth meeting this week about the material Discusses recursive. Mr Wahyu describes what a recursive function.
is a recursive function that can call themselves.
we are given an example in finding gcd (iterative function)

description
while (d> 0)
r = c% d
c = d
d = r
return (c)

eg
c = 18 and d = 12
be checked if d> 0 then r = c% d
then r = 18% 12 ==> residual (r) 6
c = d, so c = 12
d = r, so that d = 6

be checked again d> 0, 6> 0 then r2 = c% d = 12 mod 6
so that r2 = 0
c = d, so c = 6
d = r2, so that d = 0

done checking whether d is> 0??
0> 0 (no larger) then stop

The following picture of the table :

it is also given examples of the distribution function of the reduction operator
a: b = a – a-….. a (b times as much)

example a = 12, b = 3
12/3 = 4 (mean 3 to 4 times)

description:

int a, b (int a, int b)
{Int a; count = 1
while (a> 0)
a <- a-b
count <-count +1
return count

The following picture of the table :

after this, teacher gives the game.

recursive demonstrated through a play on words in groups. this is very nice πŸ˜€

Advertisements

~ by nuryanisofia on April 11, 2012.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: