Iterative and Recursive Algorithms
Not what you're looking for?
Solutions to some problems are intrinsically recursive, and writing them in an iterative fashion is difficult. The reverse also holds. Find an example or a recursive procedure and represent it as an iterative procedure. Also, choose an iterative procedure that you would re-write as recursive. What challenges did you face in the process? How did you go about resolving them?
Purchase this Solution
Solution Summary
This posting contains the answers to the given problems.
Solution Preview
Hi,
An example of a recursive algorithm is computation of a power of 2.
Using recursive algorithm, we have:
power_2 (int n) //power_2 is a recursive function using the n, value of exponent, as argument.
{
if n = 0 //if n is 0, it will return the value of 1
return 1;
...
Purchase this Solution
Free BrainMass Quizzes
Basic Computer Terms
We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.
Inserting and deleting in a linked list
This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.
C# variables and classes
This quiz contains questions about C# classes and variables.
Java loops
This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.
Excel Introductory Quiz
This quiz tests your knowledge of basics of MS-Excel.