I dont understand how to turn recursive algorythm into imperatif one.
Can /prog/ give me an exemple on this:
taking a list and generate all combinaison without double:
def foo(cdr):
if cdr == []: return ['']
solution = ['']
for car in cdr:
tmp = list(cdr)
tmp.remove(car)
solution += [car + x for x in compose_me(tmp)]
return solution
To treat the result while finding them,
here i have to wait the end of recursion to have complete data as far as each answer is foo(n) + foo(n - 1) + foo(n -1 -1)...
I though that with no recursive algo it would be possible to have complete result while creatign the list of results
It is generating all possibility, so after the whole list is generated it is possible to test them.
But it would be nice that it generate one possibility, test it, then generate second one test it and so on, like that if it find the good possibility before generating the whole list the process can stop.
bad c/c the recursion should have been here:
solution += [car + x for x in foo(tmp)]