“récursivité” Réponses codées

récursivité

You are not alone, read it again!
unclebigbay

récursivité

Did you mean: recursion //A google easter egg for recursion
Pranjal Pratap Singh

récursivité

Click here : https://www.google.com/search?q=recursion
Fancy Flatworm

récursivité

The process in which a function calls itself directly or indirectly 
is called recursion.

// Recursive Addition

f(n) = 1   n = 1
f(n) = n + f(n-1)  n > 1
Amit Shree Chandan

récursivité

Looking for the meaning of recursion ?
Click On This Link Right Here >>> https://www.google.com/search?q=recursion
Shiny Skipper

Récursivité

function multiply(arr, n) {
    if (n <= 0) {
      return 1;
    } else {
      return multiply(arr, n - 1) * arr[n - 1];
    }
  }
Clumsy Capuchin

récursivité


#https://github.com/aspittel/coding-cheat-sheets/blob/master/fundamentals/recursion.md

def factorial(n):
	if n <= 1:
		return 1
	return n * factorial(n - 1)

# Memoization
# Memoization is often useful in recursion. This is when the results of a function call are remembered so they can be used again in later function calls. This is like caching your results to use again.

# Code Example

factorial_memo = {}

def factorial(n):
	if n <= 1:
		return 1
	elif n not in factorial_memo:
		factorial_memo[n] = n * factorial(n-1)
	return factorial_memo[n]
# Tail Recursion
# Tail recursion is where calculations are performed first and then the recursive call is executed. Some programming languages, usually functional ones, optimize tail calls so they take up less room on the call stack.

def factorial(n, running_total=1):
	if n <= 1:
		return running_total
	return factorial(n-1, n * running_total)
Prickly Penguin

récursivité

#include<stdio.h>

void walk(int);

int main(void) {
    
    walk(1);

    return 0;
}

void walk(int n) {
    if(n <= 1000) {
        printf("%d\n", n);
        
        // TODO: Fix this
        walk(n);
    }
}
Roan John Ybas

récursivité

function loop(x) {
  if (x >= 10) // "x >= 10" is the exit condition (equivalent to "!(x < 10)")
    return;
  // do stuff
  loop(x + 1); // the recursive call
}
loop(0);
Owlthegentleman

récursivité

Click the Did you mean
Funny Fish

Réponses similaires à “récursivité”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code