Category:

# What is a Recursion?

Article Details
• Written By: Troy Holmes
• Edited By: W. Everett
2003-2018
Conjecture Corporation
 The American flag is reversed on the right arm of military uniforms so that the stars never appear to be in retreat.  more...

 April 20 ,  1864 :  Louis Pasteur performed his first pasteurization tests.  more...
wiseGEEK Slideshows

In computer science, many problems require a divide-and-conquer strategy. The technique of recursion uses this strategy. In its simplest form, recursion is a function that divides a problem into smaller problems until the final product can be determined. Computer science was founded on a platform of mathematics and logic. Recursion has been a part of this larger framework for many decades and it can be found in most computer programming languages today.

Dynamic programming is an implementation of recursion, which breaks a problem into components. This process enables the nesting of problems within larger problems where each sub problem requires the result from the prior problem. This type of functional recursion is typical within array manipulation.

This style of programming is beneficial because it simplifies a problem into manageable components. It also has the benefit of modular software development. This modular approach enables the creation of reusable components throughout a computer application.

Recursion works well when creating security features within computer applications. Each screen of an application may require specific business rules that determine if fields should be visible. Rather then write individual security code on each screen, a recursive function can be created to read all screens before rendering the data to the user and applying the necessary restrictions of visibility.

Graphics design is another area that fits well for a recursive problem. Imagine a program that was designed to create a square within a square. The smaller square would have the same functional requirements of the larger square with the only change being the dimensions of the two squares.

A sorting algorithm is a logical problem where a list of items must be sorted in a specific order. This type of problem resolution requires the constant shuffling of a list into a new list, until the final list is ordered as desired. A good approach to solving this problem is to create a recursive loop that continues shuffling the list until it is sorted into the final list.

The power of software automation makes the use of recursion seem trivial to most system owners. It is typically expected that security features and sorting of columns requires a simple click of a mouse or the stroke of a keyboard. Under the covers of this simple action lies the complexity and elegance of recursion in practice.