Home | | Computer Science 11th std | Iteration and recursion

Computer Science - Iteration and recursion | 11th Computer Science : Chapter 8 : Iteration and recursion

Chapter: 11th Computer Science : Chapter 8 : Iteration and recursion

Iteration and recursion

There are several problems which can be solved by doing the same action repeatedly.

Iteration and recursion

 

There are several problems which can be solved by doing the same action repeatedly. Both iteration and recursion are algorithm design techniques to execute the same action repeatedly. What is the use of repeating the same action again and again? Even though the action is the same, the state in which the action is executed is not the same. Each time we execute the action, the state changes. Therefore, the same action is repeatedly executed, but in different states. The state changes in such a way that the process progresses to achieve the desired input-output relation.

 

Iteration: In iteration, the loop body is repeatedly executed as long as the loop condition is true. Each time the loop body is executed, the variables are updated. However, there is also a property of the variables which remains unchanged by the execution of the loop body. This unchanging property is called the loop invariant. Loop invariant is the key to construct and to reason about iterative algorithms.

 

Recursion: Recursion is another algorithm design technique, closely related to iteration, but more powerful.Using recursion, we solve a problem with a given input, by solving the same problem with a part of the input, and constructing a solution to the original problem from the solution to the partial input.

 

Tags : Computer Science , 11th Computer Science : Chapter 8 : Iteration and recursion
Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
11th Computer Science : Chapter 8 : Iteration and recursion : Iteration and recursion | Computer Science


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.