Click here to Skip to main content
15,878,316 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Recursion to normal way Pin
iNoor728-Jun-20 11:00
iNoor728-Jun-20 11:00 
GeneralRe: Recursion to normal way Pin
David Crow9-Jun-20 3:15
David Crow9-Jun-20 3:15 
GeneralRe: Recursion to normal way Pin
harold aptroot8-Jun-20 10:30
harold aptroot8-Jun-20 10:30 
GeneralRe: Recursion to normal way Pin
iNoor728-Jun-20 11:01
iNoor728-Jun-20 11:01 
GeneralRe: Recursion to normal way Pin
harold aptroot8-Jun-20 11:11
harold aptroot8-Jun-20 11:11 
GeneralRe: Recursion to normal way Pin
iNoor728-Jun-20 11:39
iNoor728-Jun-20 11:39 
GeneralRe: Recursion to normal way Pin
Dave Kreskowiak8-Jun-20 16:44
mveDave Kreskowiak8-Jun-20 16:44 
AnswerRe: Recursion to normal way Pin
kalberts8-Jun-20 10:38
kalberts8-Jun-20 10:38 
Are you saying that you want the recursive solution rewritten into a non-recursive one?

Then you have two main alternatives: Either find a completely different algorithm for solving the same task.

Or do it by recursion, by maintaining your own recursion stack, e.g. in an array. The only reason for doing it that way would be because your programming language doesn't allow recursion - but I haven't seen that limitation since the days of Fortran Smile | :)

I'll admit you a secondary reason for being a little careful with recursion: If your estimate for maximum recursion depth is way off, you may experience a stack overflow. In principle, you have the same situation with your array-as-recursion stack, but as you explicitly move stack pointers (i.e. calculate array indexes), it will be far more visible to you, so that you can avoid a fatal crash. You may set up an exception handler for a "real" stack overflow as well, but usually you have a hard time getting back onto your feet with no loss of data or code flow.
GeneralRe: Recursion to normal way Pin
iNoor728-Jun-20 11:03
iNoor728-Jun-20 11:03 
GeneralRe: Recursion to normal way Pin
Richard MacCutchan8-Jun-20 21:33
mveRichard MacCutchan8-Jun-20 21:33 
GeneralExercise Pin
kalberts8-Jun-20 22:31
kalberts8-Jun-20 22:31 
GeneralRe: Exercise Pin
Richard MacCutchan8-Jun-20 22:34
mveRichard MacCutchan8-Jun-20 22:34 
JokeRe: Exercise Pin
Peter_in_27808-Jun-20 22:43
professionalPeter_in_27808-Jun-20 22:43 
GeneralRe: Exercise Pin
kalberts9-Jun-20 2:50
kalberts9-Jun-20 2:50 
GeneralRe: Exercise Pin
Richard MacCutchan9-Jun-20 3:39
mveRichard MacCutchan9-Jun-20 3:39 
GeneralRe: Exercise Pin
kalberts9-Jun-20 3:59
kalberts9-Jun-20 3:59 
GeneralRe: Exercise Pin
Richard MacCutchan9-Jun-20 4:11
mveRichard MacCutchan9-Jun-20 4:11 
GeneralRe: Exercise Pin
Richard MacCutchan9-Jun-20 4:29
mveRichard MacCutchan9-Jun-20 4:29 
GeneralRe: Exercise Pin
Richard MacCutchan9-Jun-20 20:56
mveRichard MacCutchan9-Jun-20 20:56 
GeneralRe: Exercise Pin
kalberts9-Jun-20 22:08
kalberts9-Jun-20 22:08 
GeneralRe: Exercise Pin
Richard MacCutchan9-Jun-20 23:33
mveRichard MacCutchan9-Jun-20 23:33 
QuestionIs there any opensource version of telnet client library(encrypted) available for windows Pin
Member 147721178-Jun-20 2:25
Member 147721178-Jun-20 2:25 
AnswerRe: Is there any opensource version of telnet client library(encrypted) available for windows Pin
Richard MacCutchan8-Jun-20 5:31
mveRichard MacCutchan8-Jun-20 5:31 
QuestionEfficient way to read/write file Pin
manoharbalu7-Jun-20 22:32
manoharbalu7-Jun-20 22:32 
AnswerRe: Efficient way to read/write file Pin
CPallini8-Jun-20 1:28
mveCPallini8-Jun-20 1:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.