Vakataka

Install

Vakataka, a tap away.

Add it to your home screen for a quicker way back to your next taka.

iPhone or iPad
Open in Safari, tap Share, then Add to Home Screen. Choose Open as Web App if shown, then Add.
Android
Open your browser menu and choose Install app or Add to Home screen.
Computer
Use the install icon in the address bar or your browser’s app menu. In Safari on Mac, choose File → Add to Dock.

If your browser has no install option, Vakataka still works here.

What makes a recursive process stop?

A recursive solution needs a stopping case and a way to reach it.

Recursion solves a problem by calling the same procedure on a smaller or simpler case. A base case is a case whose answer can be returned directly, without another recursive call.

Having a base case written somewhere is not enough. Each recursive step must move the relevant input towards it. If the input never reaches the stopping condition, the process can keep calling itself until it fails. Tracing a small example by hand often reveals that mistake quickly.

A small example

To count down from 3, a procedure prints 3 and repeats with 2, then 1, stopping at 0. Repeating with 3 again would never reach the base case.

Keep in mind

A recursive approach is not automatically the most efficient or clearest solution.

Source & attribution

Introduction to Python Programming — Simple math recursion

OpenStax contributors · OpenStax, Rice University

CC BY 4.0. Rewritten as a self-contained explanation; the example and reflection are Vakataka additions. Written and edited with AI assistance. No source images reproduced.

Source edition: 2024-07-30T19:17:56Z

Select the link to copy it.

Email · WhatsApp

A note to yourself

Create an account or sign in to keep private notes and saved takas across devices.