Search:

Type: Posts; User: CT&SC

Search: Search took 0.08 seconds.

  1. Replies
    7
    Views
    3,726

    Re: Converting a recursion to iteration

    ^ Just a clarification, my algorithm is already posted above and works (I'll leave as an exercise to the reader what needs to be changed about the java implementation to make it work).
  2. Replies
    7
    Views
    3,726

    Re: Converting a recursion to iteration

    Huh. Just implemented my version using javascript. I let n = 3 and made isPartialSolution the "true" function. Here's the output:

    000
    001
    010
    011
    100
    101
    110
    111
  3. Replies
    7
    Views
    3,726

    Re: Converting a recursion to iteration

    "The code that I posted above is correct and there is no need to include n in the loop. You are welcome to run it and see for yourself that it stops."
    - I think I now understand that you avoided...
  4. Replies
    7
    Views
    3,726

    Re: Converting a recursion to iteration

    Just out of curiosity, does my algorithm do what you want? I'm still not sure I've even understood what you're trying to do.

    And correct me if I'm wrong, but how does your start() function know...
  5. Replies
    7
    Views
    3,726

    Re: Converting a recursion to iteration

    I'm really not sure I understand what you're asking for... why do these iterative solutions not work?

    After looking at your code a little more carefully, I think I might have deciphered what you...
  6. Replies
    7
    Views
    3,726

    Re: Converting a recursion to iteration

    Is what you want an iterative tree traversal algorithm? That isn't too hard to make iterative.

    All you need to do is to design a state machine with the following transitions:

    START:
    - if there...
Results 1 to 6 of 6