Search:

Type: Posts; User: javapenguin

Search: Search took 0.10 seconds.

  1. [SOLVED] Re: how to trace recursion variables in a recursive method

    Treat each new call to primeFactorsR as starting at the beginning each time.

    It could either go to the if, in which case it would stop recursively calling the method.
    It could go to the else if...
  2. [SOLVED] Re: how to trace recursion variables in a recursive method

    Once it hits 5, it then goes to finish off the other recursive calls left over.

    For each of the recursive calls it had before it hit 5, it still has to call the second half that it had been...
  3. [SOLVED] Re: how to trace recursion variables in a recursive method

    That would depend if there were any more cases left, as you're still calling the method.

    It would have to go through all calls that might be entailed with

    primeFactorsR(n/m, (n/m)-1);
    ...
  4. [SOLVED] Re: how to trace recursion variables in a recursive method

    As It will be calling

    primeFactorsR(m, m-1);
    primeFactorsR(n/m, (n/m)-1);

    And will call

    primeFactorsR(m, m-1);

    until it is done, before...
  5. [SOLVED] Re: how to trace recursion variables in a recursive method

    Try adding println's.


    public class Tester {

    static boolean isPrime(int p)
    {
    for(int i = 2; i < p; i++)
    {
    if(p % i == 0)
Results 1 to 5 of 5