http://en.wikipedia.org/wiki/RecursionRecursion in programming can be adequately defined as a program or function that is at least partially defined in terms of itself...take the following code:
CODE
int factorial(int);
void main(void) {
int number;
cout << "Please enter a positive integer: ";
cin >> number;
if (number < 0)
cout << "That is not a positive integer.\n";
else
cout << number << " factorial is: " << factorial(number) << endl;
}
int factorial(int number) {
int temp;
if(number <= 1) return 1;
temp = number * factorial(number - 1);
return temp;
}
You'll note that the function actually calls itself with a new set of parameters until the break condition (in this case, the number 1) is provided. this is a simple example of recursion.
Another coomon example if recursion is th Fibonacci sequence.
Your question is likely to spawn a large thread with various examples and explanations, but the crux of the matter is above.
It is an extremely valuable concept, but it is not always necessary. Your programs to date would probably not benefit from recursion...it does not specifically make them run better, it is simply a methodology to be used where required. An example might be printing or reading a linked list or tree structure where you do not know in advance how many nodes there are.
You may wish to search the forums as well, there are several topics dedicated to recursion.