recursion

Recursion Programming

Hi! Welcome to the world of Recursion! Programs using Recursion can be made to do all sorts of things, right from calculating the factorial of a number, to playing complex games against human intelligence. This small tutorial I've put up for you will take you from the basics of Recursion all the way to the highly challenging problems, giving you a firm understanding and confidence in Recursive programming. Most of the examples in this tutorial are some well known games, such as tic-tac-toe, and are therefore a fun way to get started with programming using recursion.

There are two sections in this site. The first is the actual Tutorial, with each chapter progressing on certain topics. The second section is for those who are already comfortable with Recursion. It consists of a mix of several specific problems solved.

 

Recursion Tutorial

A step by step introduction to programming in Recursion. Please don't skip any of the chapters, since you may not be able to understand some of the chapters without reading the previous ones first.

 

   


Introduction to Recursion

Chapter 1
The basic definition of Recursion along with a kick start
into its philosophy with the Factorial function


Magic Squares

Chapter 2
Solve the famous paper-pencil puzzle of
Magic Squares using recursive functions.
[An insight into the permutation abilities of Recursion.]


Tic Tac Toe

Chapter 3
Make your program defeat you
in the world-famous game of tic-tac-toe.
[Watch Recursion work in 2-player games.]


Connect 4

Chapter 4
Enter the realm of programming
complex games like Connect-4 using Recursion.
[Depth-limit algorithms. The limitations of Recursion.]


Optimizing Recursion Trees

Chapter 5
Make your Recursive functions 10 times faster. Optimize
using a simple technique called Alpha-Beta Pruning.
Also learn about Recursion Trees.
   

Other Programs involving Recursion

Here are some other interesting programs or problems involving Recursion. You could try to solve these problems yourself, or you could simply go through the solutions I've provided. I add new problems to this section whenever I think of something new.

(Magic squares, Tic tac toe and Connect-4 have been discussed thoroughly in the Tutorial section above. Don't miss it.)

   


Sorting using Recursion

 
Two sorting algorithms which perform sorting
using Recursive techniques:
Quick Sort and Merge Sort.


Equation Generator

 

Given a few digits, insert mathematical symbols
in between to generate a valid equation.


Other Challenging Problems

 
Solve these intellectually challenging problems
involving Recursive solutions.
The finest way to lose a week's sleep..
   

More on Recursion

For more information, try this site:

Dictionary of Algorithms, Data Structures, and Problems

For additional help in any way concerning Recursion, or for suggestions or complaints or doubts,
please write to me at erw_nerve@email.com. I would love to hear from you.



home jokes programming about me resume guest book
Comments:
This page is located at http://personal.vsnl.com/erwin/recursion.htm
Display thank-you page Return to this page
Recommend this page to someone?
e-mail
e-mail