Timeline for Iterative version of a permutations algorithm
Current License: CC BY-SA 4.0
3 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 27, 2019 at 5:51 | comment | added | papagaga | @yorztif: you can configure recursion depth on compilers, and it is limited only by memory availability. But what I meant is that the compiler build an execution stack to execute the program. Execution contexts are then pushed / popped. That's what you also do when translating from recursive to iterative with a stack. Some compilers are able to translate some forms of recursion ( tail recursion) but I'm not sure C++ compilers do it. | |
Apr 27, 2019 at 1:15 | comment | added | yorztif | When you say 'you just emulate with a data structure what the compiler would have done', does that mean that you don't have to care about stack overflows anymore from deeply recursive call stacks when using a modern compiler? Can a compiler always transform a recursive algorithm into iterative form? That sounds pretty advanced. | |
Apr 26, 2019 at 11:00 | history | answered | papagaga | CC BY-SA 4.0 |