Theoretical computer science | Computability theory | Recursion

Recursion (computer science)

In computer science, recursion is a method of solving a computational problem where the solution depends on solutions to smaller instances of the same problem. Recursion solves such recursive problems by using functions that call themselves from within their own code. The approach can be applied to many types of problems, and recursion is one of the central ideas of computer science. The power of recursion evidently lies in the possibility of defining an infinite set of objects by a finite statement. In the same manner, an infinite number of computations can be described by a finite recursive program, even if this program contains no explicit repetitions. — Niklaus Wirth, Algorithms + Data Structures = Programs, 1976 Most computer programming languages support recursion by allowing a function to call itself from within its own code. Some functional programming languages (for instance, Clojure) do not define any looping constructs but rely solely on recursion to repeatedly call code. It is proved in computability theory that these recursive-only languages are Turing complete; this means that they are as powerful (they can be used to solve the same problems) as imperative languages based on control structures such as while and for. Repeatedly calling a function from within itself may cause the call stack to have a size equal to the sum of the input sizes of all involved calls. It follows that, for problems that can be solved easily by iteration, recursion is generally less efficient, and, for large problems, it is fundamental to use optimization techniques such as tail call optimization. (Wikipedia).

Recursion (computer science)
Video thumbnail

Recursive Factorial Function

Introduction to recursion.

From playlist Computer Science

Video thumbnail

A Beginner's Guide to Recursion

Recursion has an intimidating reputation for being the advanced skill of coding sorcerers. But in this tutorial we look behind the curtain of this formidable technique to discover the simple ideas under it. Through live coding demos in the interactive shell, we'll answer the following que

From playlist Software Development

Video thumbnail

Visualizing recursion with call frames

Have you learned about recursion in a computer science course, but struggled to understand it? Walk through and visualize a basic example to understand what a computer *actually* does when running a recursive algorithm.

From playlist Summer of Math Exposition Youtube Videos

Video thumbnail

Recursively Defined Sets - An Intro

Recursively defined sets are an important concept in mathematics, computer science, and other fields because they provide a framework for defining complex objects or structures in a simple, iterative way. By starting with a few basic objects and applying a set of rules repeatedly, we can g

From playlist All Things Recursive - with Math and CS Perspective

Video thumbnail

Introduction to Recursion (Data Structures & Algorithms #6)

Recursion explained. Java & Python sample code below. Check out Brilliant.org (https://brilliant.org/CSDojo/), a website for learning math and computer science concepts through solving problems. First 200 subscribers will get 20% off through the link above. Special thanks to Brilliant for

From playlist Data Structures and Algorithms

Video thumbnail

Applying the recursive formula to a sequence to determine the first five terms

👉 Learn all about recursive sequences. Recursive form is a way of expressing sequences apart from the explicit form. In the recursive form of defining sequences, each term of a sequence is expressed in terms of the preceding term unlike in the explicit form where each term is expressed in

From playlist Sequences

Video thumbnail

Java Recursion

Get the Code: http://goo.gl/S8GBL Welcome to my Java Recursion tutorial. In this video, I'm going to cover java recursion in 5 different ways. I figured if I show it using many different diagrams that it will make complete sense. A recursive method is just a method that calls itself. As

From playlist Java Algorithms

Video thumbnail

CS1

From playlist CS Teasers

Video thumbnail

6. Recursion and Dictionaries

MIT 6.0001 Introduction to Computer Science and Programming in Python, Fall 2016 View the complete course: http://ocw.mit.edu/6-0001F16 Instructor: Prof. Eric Grimson In this lecture, Prof. Grimson introduces the concept of recursion and the Python dictionary data type. License: Creative

From playlist 6.0001 Introduction to Computer Science and Programming in Python. Fall 2016

Video thumbnail

RubyConf 2019 - Fun, Friendly Computer Science by Mercedes Bernard

RubyConf 2019 - Fun, Friendly Computer Science by Mercedes Bernard Computer science concepts like Big O Notation, set theory, data structures, and principles of object-oriented programming sound intimidating, but they don’t have to be! This talk will dive into some fundamental computer sc

From playlist RubyConf 2019

Video thumbnail

SYN_018 - Linguistic Micro-Lectures: Recursion

In this short micro-lecture, Victoria Galarneau, one of Prof. Handke's students, discusses the term 'recursion', a central notion in syntax.

From playlist Micro-Lectures - Syntax

Video thumbnail

Geometer Explains One Concept in 5 Levels of Difficulty | WIRED

Computer scientist Keenan Crane, PhD, is asked to explain fractals to 5 different people; a child, a teen, a college student, a grad student, and an expert. Still haven’t subscribed to WIRED on YouTube? ►► http://wrd.cm/15fP7B7 Listen to the Get WIRED podcast ►► https://link.chtbl.com

From playlist Tutorials and Lectures

Video thumbnail

RubyConf 2016 - Rhythmic Recursion by Celeen Rusk

RubyConf 2016 - Rhythmic Recursion by Celeen Rusk One of the best things about multi-disciplinary work is recognizing familiar ideas in a different setting. It’s like running into an old friend while you’re on vacation halfway around the world-- “I had no idea you’d be here! It’s so great

From playlist RubyConf 2016

Video thumbnail

Delicia Kamins - Philosophy of Fractals - CoM Oct 2020

We know that fractals are nature’s pattern makers. Fractals are in fact everywhere we look: tree bark, snowflakes, mountain ranges, cloud, rivers, seashells, all the way up to the shape of galaxies. Beyond nature, however, human beings are fractal thinkers. We depend on fractal algorithms

From playlist Celebration of Mind

Video thumbnail

Programming Loops vs Recursion - Computerphile

Programming loops are great, but there's a point where they aren't enough. Professor Brailsford explains. EXTRA BITS: https://youtu.be/DVG5G1V8Zx0 The Most Difficult Program to Compute?: https://youtu.be/i7sm9dzFtEI What on Earth is Recursion?: https://youtu.be/Mv9NEXX1VHc Reverse Poli

From playlist Subtitled Films

Video thumbnail

1.10.7 Recursive Functions: Video

MIT 6.042J Mathematics for Computer Science, Spring 2015 View the complete course: http://ocw.mit.edu/6-042JS15 Instructor: Albert R. Meyer License: Creative Commons BY-NC-SA More information at http://ocw.mit.edu/terms More courses at http://ocw.mit.edu

From playlist MIT 6.042J Mathematics for Computer Science, Spring 2015

Related pages

Ackermann function | Primitive recursive function | Euclidean algorithm | Loop variant | Recursion | Threaded binary tree | Coinduction | Insertion sort | Turing completeness | Timsort | Lazy evaluation | Open recursion | Remainder | Mutual recursion | Merge sort | Anonymous recursion | Big O notation | Depth-first search | Recursive data type | Structural induction | Parameter | Greatest common divisor | McCarthy 91 function | Dynamic programming | Order of magnitude | Pseudocode | Factorial | Tak (function) | E (mathematical constant) | Divide-and-conquer algorithm | Definition | List (abstract data type) | Computational problem | Binary search tree | Backus–Naur form | Corecursion | Quicksort | Anonymous function | Hierarchical and recursive queries in SQL | Natural number | Short-circuit evaluation | Recurrence relation | Tail call | Computability theory | Pathological (mathematics) | Tree traversal | Tail recursion | Series (mathematics) | Time complexity | Fold (higher-order function) | Tree (data structure) | Adaptive quadrature | Iteration | Clojure | Sierpiński curve | Kleene–Rosser paradox | Termination analysis | Fractal | Newton's method | Algorithm | Algorithmic efficiency | Infinite loop