RECURENCE


 RECURENCE otherwise RECURSION

It is a very effective method, which consists in causing the process itself and spreading the problem into elementary subproblems. However, an insufficiently considered condition for the completion of such a process may lead to infinite calls and program cessation due to stack overflow. Programs with recursion often require a large amount of memory. In a recursive approach to the problem, the "divide and conquer " method is used.


„divide and conquer" is one of the main methods of designing algorithms in IT, leading to very effective solutions. The name comes from the Latin phrase divide and rule (divide and impera ). In this strategy the problem is recursively divided into two or more smaller subproblems of the same (or similar) type until the fragments become sufficiently simple to be solved directly. In turn, the solutions received for the subproblems merge to produce a solution for the whole task.

[WIKIPEDIA]

Recursive functions are functions that call themselves.


  FACTORIAL

Function name: sil
0! = 1, 1!=1, 2!=2, 3!=6, 4!=24, … 10!=3628800


 POWER - natural exponent

Function name: pot
5550=1, 20181=2018, 210=1024, 106=1000000


 POWER - integer exponent

The function pot_c uses the previous function pot. Both must occur in the program.
210=1024, 2-3=0.125, 0.05-6=64000000


 EUCLIDEAN ALGORITHM

Function name: nwd
nwd(168,189)=21,   nwd(10090, 6054)=2018


 FIBONACCI SEQUENCE

Function name: fib
F1=1, F3=2, F17=1597, F40=102334455