We may earn an affiliate commission when you visit our partners.
Inside Code

WARNING: The instructor is not currently available to answer questions regarding this course

Even if the concept of recursion is simple, a lot of people struggle with it (not understanding the recursive process, not being able to figure out the base cases and recursive cases...), this is why I wanted to create a course on recursion that explains it and illustrates it in detail, it also contains 11 solved and explained coding problems to practice.

Read more

WARNING: The instructor is not currently available to answer questions regarding this course

Even if the concept of recursion is simple, a lot of people struggle with it (not understanding the recursive process, not being able to figure out the base cases and recursive cases...), this is why I wanted to create a course on recursion that explains it and illustrates it in detail, it also contains 11 solved and explained coding problems to practice.

And knowing recursion will also give you a new way of thinking, which is dividing the problem into multiple instances of the same problem, which will help you understanding techniques like dynamic programming, backtracking...

See you in the first lecture.

The course covers:

  • What is recursion

  • Code and execution

  • Base cases and recursive cases

  • Multiple recursive calls process

  • Call stack

  • Recursion tree

  • How to visualize the process

  • Recursive functions complexity analysis (time and space comp)

  • Recursion vs Iteration

  • How to optimize a recursive function (memoization and dynamic programming)

  • Divide-and-conquer

  • Backtracking

  • Recursive data structures

  • Tail recursion

  • Double recursion

  • How to think recursively

Plus 11 solved and explained coding problems to practice:

  • Sum of digits

  • Count occurrences

  • Has adjacent duplicates

  • Reverse string

  • Minimum cost path in matrix

  • All possible phrases

  • Keypad combinations

  • String subsequences

  • Binary numbers with at most 2 zeros

  • Word search

  • Array permutations

Why you should take this course:

  • Detailed explanation of how the recursive process works

  • Animated examples

  • Good audio/video quality

  • Real English captions

  • Contains coding problems to practice

  • Ability to ask questions if you don't understand something

Enroll now

What's inside

Learning objectives

  • Recursion
  • Recursive process
  • Optimizing a recursive function (with memoization and dynamic programming)
  • Algorithmic techniques based on recursion (backtracking and divide-and-conquer)
  • Tail recursion
  • Breaking down a problem into subproblems of the same type

Syllabus

Learning about recursion and the different concepts around it
  • What is recursion?

  • How to always win the tower of Hanoi game with recursion

  • Examples of recursion

Read more
  • How is a recursive function made?

  • Base cases and recursive cases

  • How to write a recursive function?

  • What happens when a recursive function gets executed?

  • Call stack

  • What are base cases and recursive cases?

  • How to identify base cases and recursive cases?

Multiple recursive calls
  • Difference between a recursive function with one recursive call and with multiple recursive calls

  • Why do we need the recursion tree?

  • How to draw the recursion tree?

  • "ways to climb stairs" example

Visualize call stack and recursion tree
  • How to add some code to be able to visualize the call stack

  • Example on "merge sort"

  • How to add some code to be able to visualize the recursion tree

  • Example on "ways to climb stairs"

Time and space complexity analysis of recursive functions
  • Introduction to time complexity analysis of recursive functions

  • How to analyze the time complexity of a recursive function by using the recursion tree

  • How to analyze the time complexity of a recursive function by using the recurrence relation (substitution method)

  • How to analyze the time complexity of a recursive function by using the Master theorem method

  • How to analyze the space complexity of a recursive function

Recursion vs Iteration
  • The difference between iteration and recursion

  • When to choose iteration?

  • When to choose recursion?

  • How to transform a recursive function into an iterative one?

  • How to transform an iterative function into a recursive one?

Optimize a recursive function with memoization and dynamic programming
  • What is memoization?

  • How does it work?

  • How to implement memoization?

  • How to optimize "ways to climb stairs" solution with memoization?

  • Process demonstration

  • Solution code

  • What is dynamic programming?

  • How does it work?

  • "Fibonacci nth term" example

  • How to optimize "ways to climb stairs" solution with dynamic programming?

  • Process demonstration

  • Solution code

Divide-and-conquer and backtracking
  • What is divide-and-conquer?

  • "Merge sort" example

  • "Karatsuba algorithm" example

  • Decrease-and-conquer

  • What is backtracking?

  • "Combinations with valid weight" example

  • "N-queens" problem description

  • Solution explanation

  • Process demonstration on an example

  • Solution code

Recursive data structures
  • What is a recursive data type?

  • What is a linked list?

  • Traversal and searching example

  • What is a tree?

  • Recursive manipulations examples

  • What is a graph?

  • DFS traversal

Tail recursion
  • What is tail recursion?

  • The benefit of using tail recursion

  • How to transform a non-tail-recursive function into a tail-recursive one

  • "Factorial" example

  • "Replace in array" example

  • "Sum to n" example

  • "a power b" example

  • "get minimum" example

  • "binary tree inorder traversal" example

  • "Fibonacci nth term" example

Double recursion
  • What is double recursion?

  • "Ackermann function" example

How to think recursively
  • Understanding

  • Dividing the problem into sub-problems

  • Trusting the recursive process

  • Visualizing the recursive process

  • Practising

Coding problem #1: Sum of digits problem
Solve the problem
  • "Sum of digits" problem description

  • Solution explanation

  • Process demonstration on an example

  • Solution code

Coding problem #2: Count occurrences
  • "Count occurrences" problem description

  • Solution explanation

  • Process demonstration on an example

  • Solution code

Coding problem #3: Has adjacent duplicates problem
  • "Minimum cost path in matrix" problem description

  • Solution explanation

  • Process demonstration on an example

  • Solution code

  • "Has adjacent duplicates" problem description

  • Solution explanation

  • Process demonstration on an example

  • Solution code

Coding problem #4: Reverse string
Important note
  • "Reverse string" problem description

  • Solution explanation

  • Process demonstration on an example

  • Solution code

Practicing your recursion and backtracking knowledge on different coding problems
Coding problem #6: All possible phrases
  • "All possible phrases" problem description

  • Solution explanation

  • Process demonstration on an example

  • Solution code

Coding problem #7: Keypad combinations
  • "Keypad combinations" problem description

  • Solution explanation

  • Process demonstration on an example

  • Solution code

Coding problem #8: String subsequences
  • "String subsequences" problem description

  • Solution explanation

  • Process demonstration on an example

  • Solution code

Coding problem #9: Binary numbers with at most 2 zeros
  • "Binary numbers with at most two zeros" problem description

  • Solution explanation

  • Process demonstration on an example

  • Solution code

Coding problem #10: Word search
  • "Word search" problem description

  • Solution explanation

  • Process demonstration on an example

  • Solution code

Coding problem #11: Array permutations
  • "Array permutations" problem description

  • Solution explanation

  • Process demonstration on an example

  • Solution code

Conclusion

Save this course

Save Recursion to your list so you can find it easily later:
Save

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Recursion with these activities:
Review Data Structures
Reinforce your understanding of fundamental data structures, as recursion is often used to traverse and manipulate them.
Browse courses on Trees
Show steps
  • Review the definitions of common data structures.
  • Practice implementing basic operations on each data structure.
  • Solve simple problems using these data structures.
Read 'Introduction to Algorithms'
Deepen your understanding of recursion with a comprehensive textbook that covers algorithms in detail.
Show steps
  • Obtain a copy of 'Introduction to Algorithms'.
  • Read the chapters related to recursion, divide-and-conquer, and dynamic programming.
  • Work through the examples and exercises in the book.
Read 'Grokking Algorithms'
Supplement your learning with a book that provides a visual and intuitive explanation of algorithms, including recursion.
Show steps
  • Obtain a copy of 'Grokking Algorithms'.
  • Read the chapters related to recursion and tree traversal.
  • Work through the examples and exercises in the book.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Implement Recursive Algorithms
Practice implementing recursive solutions to common algorithmic problems to solidify your understanding.
Show steps
  • Choose a set of recursive problems from platforms like LeetCode or HackerRank.
  • Implement the recursive solutions in your preferred programming language.
  • Test your solutions thoroughly with various test cases.
  • Analyze the time and space complexity of your solutions.
Create a Recursion Visualization
Develop a visual representation of a recursive algorithm to enhance understanding and retention.
Show steps
  • Choose a recursive algorithm, such as factorial or Fibonacci.
  • Create a diagram or animation that illustrates the call stack and recursive calls.
  • Add annotations to explain the flow of execution and base cases.
  • Share your visualization with others and gather feedback.
Build a Recursive File System Explorer
Apply your knowledge of recursion to build a practical application that explores a file system recursively.
Show steps
  • Design the user interface and functionality of the file system explorer.
  • Implement a recursive function to traverse the file system directory structure.
  • Display the files and directories in a user-friendly format.
  • Add features like filtering and searching.
Tutor Students in Recursion
Reinforce your understanding of recursion by explaining the concepts to other students.
Show steps
  • Offer to tutor students who are struggling with recursion.
  • Explain the concepts in a clear and concise manner.
  • Provide examples and exercises to help them practice.
  • Answer their questions and address their concerns.

Career center

Learners who complete Recursion will develop knowledge and skills that may be useful to these careers:
Algorithm Developer
An Algorithm Developer specializes in designing and implementing efficient algorithms for solving complex problems. The Recursion course is directly relevant to this role, as recursion is a core technique in algorithm design. The course covers a variety of topics essential for algorithm development including recursion, divide-and-conquer, and backtracking. The course also provides hands-on practice with coding problems that require recursive thinking. Understanding how to optimize recursive functions, as taught in the course, is crucial for creating high-performance algorithms. This course's detailed explanation of the recursive process and emphasis on problem-solving makes it valuable for anyone aiming to be an Algorithm Developer.
Software Engineer
A Software Engineer designs, develops, and tests software applications. This often involves problem-solving and creating efficient, reliable code. The Recursion course helps build a foundation in understanding recursion, a crucial concept in computer science. Recursion is a powerful technique for solving problems by breaking them down into smaller, self-similar subproblems. This course covers not only the theory behind recursion but also its practical applications, including divide-and-conquer and backtracking algorithms. The coding problems provided offer hands-on experience that is directly applicable to the challenges faced by a Software Engineer. The ability to visualize the recursive process, as taught in the course, contributes to debugging complex code efficiently.
Game Developer
A Game Developer creates video games, often requiring strong programming skills and problem-solving abilities. The Recursion course helps build a foundation in understanding recursion, which is essential for many game development tasks, such as AI pathfinding, procedural content generation, and game physics simulations. Understanding the call stack and recursion tree, as explored in the course, can aid in debugging complex game logic. Also, the course explains divide-and-conquer. A Game Developer who understands the techniques in this course will be able to develop games more efficiently.
Robotics Engineer
A Robotics Engineer designs, builds, and programs robots. This requires a strong understanding of algorithms and control systems. The Recursion course helps build a foundation in understanding recursion, which is useful in robot control algorithms, path planning, and sensor data processing. This course covers algorithmic techniques based on recursion, such as backtracking and divide-and-conquer. Through the provided coding problems, a Robotics Engineer can develop hands-on experience with recursive problem-solving. The course's explanation of recursive data structures is particularly relevant for managing robot state and sensor information.
Embedded Systems Engineer
An Embedded Systems Engineer designs and develops software for embedded systems, which are specialized computer systems that perform specific tasks within larger devices. The Recursion course helps build a foundation in understanding recursion, which is used in embedded systems for tasks such as interrupt handling and real-time data processing. The course's coverage of time and space complexity analysis aids in optimizing code for resource-constrained embedded environments. Tail recursion, a topic covered in the course, is valuable for writing efficient code that minimizes stack usage. The divide-and-conquer approach can be applied to partitioning complex tasks in embedded systems.
Data Scientist
A Data Scientist analyzes large datasets to extract meaningful insights, often using programming skills. The Recursion course can be useful because recursion is a fundamental concept that appears in various algorithms used in data science, such as tree traversal and graph algorithms. The course's coverage of time and space complexity analysis helps a Data Scientist to evaluate the efficiency of algorithms. The divide-and-conquer techniques discussed in the course are relevant to designing efficient data processing pipelines. Learning about optimizing recursive functions with memoization and dynamic programming, specifically, can improve the performance of data analysis tasks.
Compiler Designer
A Compiler Designer develops the software that translates human-readable code into machine-executable instructions. The Recursion course can be useful because recursion is fundamental to compiler design, particularly in parsing and syntax analysis. The course's coverage of recursion helps a Compiler Designer to understand how compilers process nested structures and recursive grammars. The backtracking techniques can be applied to error recovery and code optimization. This role typically requires a master's degree or doctorate.
Natural Language Processing Engineer
A Natural Language Processing Engineer develops algorithms and models that enable computers to understand and process human language. The Recursion course may be useful because recursion is a fundamental concept in NLP, particularly in parsing and syntax analysis. The course's coverage of recursion helps an NLP Engineer to understand how NLP systems process nested structures and recursive grammars. The backtracking techniques in the course can be applied to error recovery and ambiguity resolution. This role may benefit from an advanced degree.
Quantitative Analyst
A Quantitative Analyst, often called a quant, uses mathematical and statistical methods to solve problems in finance. The Recursion course may be useful in this field, as recursion can be applied to problems such as option pricing and risk management. The course's coverage of time and space complexity analysis can assist in evaluating the efficiency of financial algorithms. Dynamic programming, as taught in the course, can be used to optimize trading strategies. Quants often need to think recursively when designing and implementing algorithms.
Bioinformatics Scientist
A Bioinformatics Scientist uses computational techniques to analyze biological data. The Recursion course may be useful because recursion can be applied to problems such as sequence alignment and phylogenetic tree construction. The course's coverage of recursion helps a Bioinformatics Scientist to understand tree traversal and graph algorithms, data structures commonly used in bioinformatics. Additionally, dynamic programming, as taught in the course, can be used to optimize sequence alignment algorithms. This role typically requires an advanced degree.
DevOps Engineer
A DevOps Engineer manages and automates software development and deployment processes. The Recursion course may be useful in this role, as recursion can play a part in scripting and automation tasks. The course's coverage of recursion helps a DevOps Engineer to write more concise and expressive code for automating complex tasks. Additionally, understanding tail recursion can assist with writing efficient scripts for managing infrastructure. By using recursion, the DevOps Engineer can effectively manage a variety of complex tasks.
Database Administrator
A Database Administrator manages and maintains databases, ensuring data integrity and availability. The Recursion course may be useful in this role. The course's coverage of recursion helps a database administrator to understand tree traversal and graph algorithms, which are used in database indexing and query optimization. A Database Administrator may then be able to use recursion to perform various tasks. The course's approach to problem decomposition may improve the ability to troubleshoot database issues.
Quality Assurance Engineer
A Quality Assurance Engineer tests software to ensure it meets quality standards. The Recursion course may be useful, as recursion helps to create test cases that cover various scenarios, including boundary conditions and edge cases. Understanding how recursive functions work and how to visualize the recursive process, as taught in the course, helps a Quality Assurance Engineer design comprehensive test plans. Therefore, a Quality Assurance Engineer may find this course helpful when developing test cases.
Technical Writer
A Technical Writer creates documentation for software and hardware products. The Recursion course is of limited use for this role since technical writing primarily focuses on clear communication and documentation skills rather than algorithm design. Therefore, it is recommended to seek a different career which suits the course's syllabus better. Technical writing requires strong communication skills, and this course will not help you refine them.
Network Engineer
A Network Engineer designs, implements, and manages computer networks. The Recursion course is of limited use for this role since networking primarily involves understanding network protocols, hardware configurations, and security principles rather than algorithm design. Therefore, it is recommended to seek a different career which suits the course's syllabus better. This course will not give you the knowledge needed for a Network Engineer.

Reading list

We've selected two books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Recursion.
Known as CLRS, this comprehensive textbook covers a wide range of algorithms, including detailed explanations and analyses of recursive algorithms. It delves into the time and space complexity of recursive functions, divide-and-conquer strategies, and dynamic programming techniques. valuable reference for understanding the theoretical underpinnings of recursion and its efficiency. It is commonly used in undergraduate and graduate algorithms courses.
Provides a visually engaging and easy-to-understand introduction to algorithms, including recursion. It uses illustrations and step-by-step explanations to make complex concepts accessible to beginners. While not as comprehensive as some other algorithm textbooks, it good choice for those who prefer a more visual and intuitive approach. It good supplementary reading for those new to algorithms.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser