Lesson Recursion - Artificial Intelligence - ثالث ثانوي

Lesson 1 Recursion

Artificial Intelligence Algorithms

Learning Objectives

Tools

Lesson 1 Recursion

Dividing the Problem

Recursion

Lesson 1 Recursion

Let's look at an example of a function that calls another.

Recursive Function

Lesson 1 Recursion

The recursive function consists of two states:

Recursion Common Examples

Lesson 1 Recursion

Now let's calculate the factorial of a number using a factorial function.

Table 2.2: Advantages and disadvantages of recursion

Recursion and Iteration

Table 2.3: Recursion and Iteration

Lesson 1 Recursion

When do you use recursion?

Lesson 1 Recursion

In the next program, you will create a recursive function to calculate the power of a number.

Infinite Recursive Function

Lesson 1 Recursion

Read the sentences and tick True or False.

What are the differences between iteration and recursion?

When should recursion be used?

Lesson 1 Recursion

List the advantages and disadvantages of using recursion.

Write a Python recursive function to calculate the nth largest number in a list.

Write a Python recursive function to calculate the sum of all the even numbers in a list.