Algorithms, Blockchain and Cloud

Teaching Kids Programming – Recursion in Five Minutes


Teaching Kids Programming: Videos on Data Structures and Algorithms

The factorial function f(n) implemented in Python using Recursion:

def f(n):
   if n == 1:
      return 1
   return n * f(n - 1)

Factorial Recursive Equation


Recursion is basically a function calls itself! Some modern compilers may be able to optimise the Recursion implementation into a Loop: Understanding Tail Recursion – Visual Studio C++ – Assembly View

–EOF (The Ultimate Computing & Technology Blog) —

250 words
Last Post: Counting Maximal Value Roots in Binary Tree using Depth First Search Algorithm
Next Post: Check If an Array Represents a Max Heap (Danny Heap Algorithm)

The Permanent URL is: Teaching Kids Programming – Recursion in Five Minutes (AMP Version)

Exit mobile version