Update
This commit is contained in:
parent
124b9d1e7c
commit
3f374a4713
85 changed files with 2281 additions and 2272 deletions
|
@ -49,7 +49,7 @@ Note that even in computing we can use an infinite recursion sometimes. For exam
|
|||
unsigned int factorial(unsigned int x)
|
||||
{
|
||||
unsigned int result = 1;
|
||||
|
||||
|
||||
while (x > 1)
|
||||
{
|
||||
result *= x;
|
||||
|
@ -68,7 +68,7 @@ Here is another example of elegant recursion: printing string backwards:
|
|||
void readAndPrintBackwards(void)
|
||||
{
|
||||
int c = getchar();
|
||||
|
||||
|
||||
if (c != EOF)
|
||||
{
|
||||
readAndPrintBackwards();
|
||||
|
@ -93,7 +93,7 @@ readAndPrintBackwards:
|
|||
<? ?
|
||||
readAndPrintBackwards
|
||||
.
|
||||
|
||||
|
||||
->
|
||||
.
|
||||
|
||||
|
@ -106,4 +106,4 @@ How do the computers practically make recursion happen? Basically they use a [st
|
|||
|
||||
Another important type of recursion is **tail recursion** which happens when the recursive call in a function is the very last command. It is utilized in functional languages that use recursion instead of loops. This kind of recursion can be optimized by the compiler into basically the same code a loop would produce, so that e.g. stack won't grow tremendously.
|
||||
|
||||
Mathematical recursive functions find use in [computability](computability.md) theory where they help us (similarly to e.g. [Turing machines](turing_machine.md)) define [classes](class.md) of functions (such as primitive recursive and partial recursive) by how "computationally strong" of a computer we need to compute them.
|
||||
Mathematical recursive functions find use in [computability](computability.md) theory where they help us (similarly to e.g. [Turing machines](turing_machine.md)) define [classes](class.md) of functions (such as primitive recursive and partial recursive) by how "computationally strong" of a computer we need to compute them.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue