"M Hayouka" <Hayouka@bezeqi nt.net> wrote in message
news:3f58a8ef$1 @news.bezeqint. net...
| > > can anybody give me a web that I can learn about a recursion function
| > >
| > > I don't really understand it
Well, the definition of recursion in programming terms is pretty simple:
whenever a function calls itself, it is a recursive function.
Usually, this technique is used to break-down a problem
where you need to repeat the same operation multiple
times on different inputs, until a certain goal
has been found (there has to be an end-condition,
or you have infinite recursion ==> program crash).
Examples are the traversal of binary trees, or the
computations of some mathematical functions:
unsigned long factorial( long i )
{
if(i<=1) return 1;
else return i * factorial(i-1);
}
If you are confused by what a 'factorial' or a 'binary tree' is,
you probably should read about these concepts first.
I hope this helps as a start. Note also that 'recursion' is
definitely not a C++-specific question. In the first place,
it is a common mathematical concept...
"Ivan Vecerina" <ivec@myrealbox .com> wrote in message
news:3f58cd30$1 @news.swissonli ne.ch...[color=blue]
>
> "M Hayouka" <Hayouka@bezeqi nt.net> wrote in message
> news:3f58a8ef$1 @news.bezeqint. net...
> | > > can anybody give me a web that I can learn about a recursion[/color]
function[color=blue]
> | > >
> | > > I don't really understand it
>
> Well, the definition of recursion in programming terms is pretty simple:
> whenever a function calls itself, it is a recursive function.
>
> Usually, this technique is used to break-down a problem
> where you need to repeat the same operation multiple
> times on different inputs, until a certain goal
> has been found (there has to be an end-condition,
> or you have infinite recursion ==> program crash).
>
> Examples are the traversal of binary trees, or the
> computations of some mathematical functions:
>
> unsigned long factorial( long i )
> {
> if(i<=1) return 1;
> else return i * factorial(i-1);
> }
>
> If you are confused by what a 'factorial' or a 'binary tree' is,
> you probably should read about these concepts first.
>
>
> I hope this helps as a start. Note also that 'recursion' is
> definitely not a C++-specific question. In the first place,
> it is a common mathematical concept...
>
>
> hth
> --
> http://www.post1.com/~ivec <> Ivan Vecerina
>
>
>
>[/color]
Comment