Category: 

What is a Recursion?

Article Details
  • Written By: Troy Holmes
  • Edited By: W. Everett
  • Last Modified Date: 11 November 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
The mongoose was introduced to Hawaii in order to kill rats, but mongooses hunt in the day, while rats are nocturnal.  more...

December 7 ,  1941 :  Japanese bombers attack Pearl Harbor.  more...

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.

Ad

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.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

Post Anonymously

Login

username
password
forgot password?

Register

username
password
confirm
email