What is the different between recursive and iterative approach?
Q. I'm currently doing my part of assignment, I want to know about what is recursive approach,iterative approach in programming language. And also what is the differences between both methods?(* I'm using Pascal and Visual Basic) Thanks!
Asked by Calvin Tan - Wed Apr 11 10:25:45 2007 - - 6 Answers - 0 Comments

A. Repetition in computer programs is accomplished in one of two ways: either through recursion or through iteration. Both approaches result in a process being repeated several times. In general, recursion tends to be a more natural approach if the problem/question/formula is initially expressed in a recursive manner, and iteration tends to be a more natural approach if the problem/question/formula is expressed as a process done a specified number of times. Recursion tends to be more problematic for a computer to implement (but easier for a programmer to code!), however, while iteration is much more efficient for a computer to implement. For a comparison of the advantages or disadvantages of each, plz check: Hope this helps.
Answered by Smutty - Wed Apr 11 16:14:09 2007

Finding the biggest number in a binary tree recursive algorithm?
Q. I need some ideas on how to write a recursive algorithm that finds the biggest number in a binary tree. (A Binary Tree, not a Sorted Binary Tree/Binary Search Tree). That biggest number can be anywhere in the tree.
Asked by anonymous - Sat Feb 6 18:57:20 2010 - - 1 Answers - 0 Comments

A. Do any particular traversal of the tree (inorder, postorder, preorder) and track the largest number while doing the traversal. If you're not doing this for a class, you should use a max-heap which will allow you to find the biggest value at its root node, everytime.
Answered by Pete S - Sat Feb 6 19:10:13 2010

What's the difference between a recursive and base case?
Q. I know recursive functions are functions that call themselves, but what exactly is a base case?
Asked by Bo - Sun May 3 18:20:17 2009 - - 1 Answers - 0 Comments

A. A base case is a condition that if is true, returns a value or void from the method. The recursive calls must stop at some point or you'll produce stack overflow.
Answered by Blackcompe - Sun May 3 18:53:46 2009

What are the recursive and explicit formulas?
Q. If the following is an geometric sequence, find the missing spaces and explicit and recursive formula. 48,_,_,162,... i need help solving the problem above. thanks!
Asked by aznhappygrl - Mon May 18 00:10:18 2009 - - 2 Answers - 0 Comments
Write a recursive C++ function that writes the digits of a positive decimal integer in reverse order?
Q. It has to be a recursive function with one argument with no local or global variables.
Asked by sparrow - Wed Sep 2 12:47:51 2009 - - 3 Answers - 0 Comments

A. it is pseudo code cos i never learnt the c++ Syntax but i prog in c c# java ... ... etc pascal ..lol method reverseIntWriting param int iNumber output int reversedInt { if iNumber is equal of greater then 10 { return (iNumber modulo 10) * (10 power(logarith base 10 of iNumber)) + reverseIntWriting( iNumber / 10 ) } but if iNumber is lower then 10 then return iNumber } Edit 1 : well i wrote it in c #include #include int reverse( int iNumber ) { if( iNumber >= 10 ) { return (iNumber % 10) * pow(10, (int)log10((double)iNumbe r)) + reverse(iNumber / 10); } else { return iNumber; } } int main() { printf ( "%d",reverse(123456789)); }
Answered by NJR-Team.com - Wed Sep 2 13:53:28 2009

How can a recursive formula be turned into an explicit formula?
Q. Is it possible for all recursive formulae?
Asked by KGN - Fri Jan 4 18:40:29 2008 - - 3 Answers - 0 Comments

A. There is a entire field dedicated to this problem: it goes by the name "generating functions". Depending on your particular formula, this method will be easier or harder to apply. For example, if you have a linear, constant coefficients formula, then your problem is always solvable and will lead to a rational (quotient of two polynomials) generating function, that can then be inverted to give a closed formula. In this respect, this method is formally similar to Laplace or Fourier Transform methods (or, more closely, the z-transform, if you ever heard of it; if you don't, that's not essential). On the other hand, if your recurrence is not of the above type, then the application will be harder: you'll have to use more complicated… [cont.]
Answered by JCS - Fri Jan 4 19:32:05 2008

How do you solve for r in 40=30(r^15) And convert a recursive formula to Explicit?
Q. 40=30(r15) In words, forty equals thirty multiply by r to the power of 15. The recursive formula is tn=(tn-1)/4+30, where t1=30. (the n in tn, n-1 in tn-1 should be a subscript.) Thank you in advance.
Asked by IronChef - Thu Oct 23 20:18:32 2008 - - 1 Answers - 0 Comments

A. Solving for r is fairly simple; you just have to reverse the order of operations to isolate r. So, first, divide by thirty on both side sof the equation: 40/30 = 30r^15/30 4/3 = r^15 Then you have to take the fifteenth root (or raise both sides of the equaiont to 1/15) (4/3)^(1/15) = r To get an explicit formula, it usually helps write out each term in terms of t1 and find the pattern t1 = 30 t2 = t1/4 +30 = 30/4 + 30 t3 = t2/4 + 30 = (t1/4 + 30)/4 + 30 = t1/16 + 30/4 +30 = 30/16 + 30/4 + 30 t4 = t3/4 + 30 = [t1/16 + 30/4 +30]/4 + 30 = t1/64 + 30/16 + 30/4 + 30 = 30/64 + 30/16 + 30/4 + 30 In general, tn = SIGMA[from 0 to n](30/(4^n))
Answered by ATumorNamedMarla - Thu Oct 23 21:01:35 2008

How do you do a recursive formula for this sequence?
Q. How do you do a recursive formula for this sequence: 3,5,7,9,11
Asked by Peter Brown - Fri Aug 14 20:47:43 2009 - - 1 Answers - 0 Comments

A. a sub 1 = 3 (means the first term is 3) a sub n = a sub (n-1) +2 (means take the previous term (n-1) and add 2.
Answered by Angela - Fri Aug 14 21:03:57 2009

How to use recursive and explicit sequence rules, 8th grader?
Q. for example it says write the recursive rule for 20, 11, 2 , and -7 ... explain the parts of each formula please
Asked by Therspker - Fri Dec 11 20:24:10 2009 - - 1 Answers - 0 Comments

A. You are subtracting 9 each term. 20 - 9 = 11 11 - 9 = 2 2 - 9 = -7 etc... I'm not what the rules you mention are but that's the pattern. A function for it might look like: f(x) = { 20 if x = 1, f(x - 1) - 9 otherwise }
Answered by RBS - Fri Dec 11 20:42:10 2009

Anyone know how to write a log recursive method in java?
Q. I'm having a lot of trouble with recursion and I need to write a recursive method that returns the logarithm of a value to the given base. (MathRec is the class) int log(int base, int value) MathRec.floorLog(2, 8) should return 3, since log28 = 3. You may assume that the base and the value are both positive and that the value is an integer power of the base.
Asked by ladeedah - Sat Apr 11 02:07:30 2009 - - 1 Answers - 0 Comments

A. Java Example Recursive Method :
Answered by black-mamba - Sat Apr 11 06:21:02 2009

What is the recursive rule for Paving Patterns POW 2 on finding how many ways to lay out a 20 foot path?
Q. The path is to be exactly 2 feet wide. Each paving stone is rectangular, with the dimensions 1 foot by 2 feet. Al and Betty want to know how many different ways there are to lay out the stones. The path is 20 feet long altogether.
Asked by nvmbrspeed - Mon Oct 6 23:41:33 2008 - - 1 Answers - 0 Comments

A. Hello Fibonacci numbers! Let f(n) be the number of ways you can tile the a path that is n feet long. Note: f(1) = 1 and f(2) = 2. If n>2, then we can start tiling it one of two ways: Case 1: Lay the first stone flush with the end. Then there is a path n-1 feet long left. Case 2: Lay the first stone along the path. In order for the path to be tiled, the second stone must be laid parallel with it, leaving a path n-2 feet long left. I.e. : f(n) = f(n-1) + f(n-2) We now can recognize f(1) = 1, f(2) = 2, and f(n) = f(n-1) + f(n-2) as the Fibonacci numbers. Solving for f(20), we get: f(20) = 10946 different ways to lay the stones.
Answered by Awms A - Tue Oct 7 00:03:17 2008

How to write a recursive method for generating fibonacci series?
Q. P.S. it should be a simple program .
Asked by R!Ts - Sun Nov 9 13:48:54 2008 - - 2 Answers - 0 Comments

A. The following two files will do it: ---Driver.java--- public class Driver { public static void main(String[] args) { for (double i = 0; i < 40; i++) { double result = Functions.Fibonacci(i); System.out.println("Fibon acci(" + i + ") = " + result); } } } --- ---Functions.java--- import java.util.Collections; import java.util.List; public class Functions { public static double Fibonacci(double term) { if (term == 0) { return 0; } if (term == 1) { return 1; } return Fibonacci(term - 1) + Fibonacci(term - 2); } } ---
Answered by TK "Snobol" Erlang - Mon Nov 17 09:31:37 2008

how to display the elements of binary tree using non-recursive function?
Q. I want to display the elements of binary tree as Inserted. e.g. insertion is 12 7 34 54 it should display 12 7 34 54 no traversals should be used. display function shoud be non-recursive.
Asked by Vijay - Fri Nov 13 22:54:43 2009 - - 1 Answers - 0 Comments

A. By using either a stack or a queue data structure, any tree-like structure can be traversed without use of recursion. The stack or queue data structure takes the place of the stack of function calls created via recursion. All you need is some way of remembering where you are in the tree and what's still left to traverse as you do your traversal.
Answered by videobobkart - Mon Nov 16 17:35:22 2009

How do you write recursive pseudocode that looks for the minimum value in an array?
Q. I already know the pseudocode but it's the recursive parts that boggles me I already know the iterative pseudocode but the recursive still boggles me
Asked by the catcher - Mon Jan 4 19:23:39 2010 - - 1 Answers - 0 Comments

A. public class MinArray{ public static void main(String args[]) { int a[]={33,32,31,30,35}; //example array of 5 elements System.out.println(minArr ay(a,0,4)); } //function to find min of two integer values public static int min(int m,int n){ if(m>n) return n; else return m; } //main recursive function to find the minimum public static int minArray(int a[],int start,int stop){ if(start==stop) //if single element return the same return a[start]; else if(stop-start==1) // if two element use the function above return min(a[start],a[stop]); else //otherwise compare the start with the min of rest of the array return min(a[start],minArray(a,s tart+1,stop)); } } Enjoy :)
Answered by MK - Mon Jan 4 20:28:42 2010

How do I write a recursive formula for this sequence?
Q. -15,-11,-7,-3 I know it decreases by 4 each term but could someone please help?
Asked by Anna! - Mon Sep 14 20:57:31 2009 - - 1 Answers - 0 Comments

A. For a recursive formula, you need to state what the first term a(1) is, then what a(n) is using the previous term a(n - 1), which like you said is to subtract 4 from it a(1) = -15 a(n ) = a(n - 1) - 4
Answered by hayharbr - Mon Sep 14 21:02:36 2009

What does it mean to say that a recursive theory of truth can serve as the foundation of a theory of meaning?
Q. I am VERY stuck with a university assignment and need some help with this. Anyone know any good website I go visit for help?
Asked by Liam - Sun Jan 24 12:22:39 2010 - - 1 Answers - 0 Comments

A. it means that any theory has to be based off of a fact. it can't be based off of another theory. you can't have a theory that bases off of evolution, because evolution is just a theory. you can have a theory bases off of the fact that men can grow to be over 7 feet tall, or that ever part of life of this planet needs water to survive. do you get waht i'm saying?
Answered by silvana =) - Sun Jan 24 12:33:12 2010

How do you convert the recursive formula a(n)=3a(n-1)-a(n-2) to an explicit one?
Q. Some sort of proof would be nice. If it helps, this comes from the tiling of heptagons in the hyperbolic plane where a(1)=7 and a(2)=21.
Asked by Ivan - Fri Feb 5 03:09:25 2010 - - 1 Answers - 0 Comments

A. This is a linear recurrence relation with constant solutions. Assume that a(n) = r^n for some (complex) number r. ==> r^n = 3r^(n-1) - r^(n-2) ==> r^(n-2) * (r^2 - 3r + 1) = 0. Ignoring the first factor, we get r^2 - 3r + 1 = 0 ==> r = [3 sqrt(5)]/2. Thus, the general solution may be written a(n) = A [(3 + sqrt(5))/2]^n + B [(3 - sqrt(5))/2]^n for some A, B. We may find A and B given data, by using a(1)=7 and a(2)=21. I hope this helps!
Answered by kb - Fri Feb 5 13:18:47 2010

Provide a recursive definition for the following sequence?
Q. Provide a recursive definition for the following sequence {a_n}, n=1,2,... a_n = 2n^2 - n I cannot figure out the recursive formula to this one, but I have come up with a short series for it. {a_1, a_2, a_3, a_4, a_5} = {1, 6, 15, 28, 45} Show your work.
Asked by Runty - Tue Mar 2 13:03:01 2010 - - 1 Answers - 0 Comments

A. a_n+1 = 2(n+1)^2 - (n+1) = 2n^2 +4n +2 - n -1 = 2n^2 +3n +1 = a_n + 4n +1 a_n+1 = = a_n + 4n +1 (yep it works)
Answered by Shoshanna - Tue Mar 2 13:23:21 2010

What is the sequence in a recursive formula?
Q. The question I'm looking at says... What is the y-intercept of the line that contains these points? How is it related to the sequence? the last question is the one I don't get. Please help!!
Asked by Silver - Mon Sep 14 22:30:20 2009 - - 1 Answers - 0 Comments

A. this means that your set of points will fit a line described by y = mx + b, for some constant values m and b. you need b.
Answered by Alam Ko Iyan - Mon Sep 14 22:43:39 2009

What are recursive and explicit formulas?
Q. I really don't understand what the formulas are. I'm hoping someone can help. if I didn't make my self clear or I'm not understandable just tell me so. Thanks in advance.
Asked by miss not so perfect - Sun Sep 20 20:29:46 2009 - - 1 Answers - 0 Comments

From Yahoo Answer Search: 'recursive'
Wed Mar 17 12:03:22 2010 [ refresh local cache ]

Life Technologies Introduces Nanocrystal-Based Single Molecule Sequencing ... - Genetic Engineering News (press release)
news.google.com
Life Technologies Introduces Nanocrystal-Based Single Molecule Sequencing ...

Genetic Engineering News (press release)

The promising combination of long reads and inherent accuracy enabled by recursive sequencing have the potential to make Life Technologies' single molecule ...

Life Technologies Unveils Single Molecule Sequencing Technology EON: Enhanced Online News (press release)



all 16 news articles &raquo;
Google News Search: recursive,
Tue Mar 16 15:10:12 2010
Non- recursive automake drboblog
tecnocode.co.uk
Non- recursive automake drboblog

Philip Withnall

ue, 29 Dec 2009 21:33:54 GM

A while back, I was toying with the idea of adding gcov support to libgdata, to give metrics on the code coverage of the test suite. I played around with adding.

Google Blogs Search: recursive,
Fri Jan 1 00:27:22 2010