Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

dynamic allocation in recursion

Gregry2Gregry2 Posts: 607Member
I'm back, after so long...

but nvmd about that, this is my question

I've making a recursive algorithm, but have failed to find an alternative to using dynamic arrays in it, for each call requires a variable length array. Can this slip through, just this once?

Secondly, another horror is that each array needs to be initialized, one sneaky trick I thought of is to rather use a large single array instead of three (which each call has), and probably to use two other pointers to simulate the other arrays as seperate, or just use a special indexing scheme, so it can all be initialized once, instead of thrice. The algorithm is save from overflow, im sure, but is it okay?

thats all, thnx
{2}rIng

Comments

  • shaolin007shaolin007 Posts: 1,018Member
    : I'm back, after so long...
    :
    : but nvmd about that, this is my question
    :
    : I've making a recursive algorithm, but have failed to find an alternative to using dynamic arrays in it, for each call requires a variable length array. Can this slip through, just this once?
    :
    : Secondly, another horror is that each array needs to be initialized, one sneaky trick I thought of is to rather use a large single array instead of three (which each call has), and probably to use two other pointers to simulate the other arrays as seperate, or just use a special indexing scheme, so it can all be initialized once, instead of thrice. The algorithm is save from overflow, im sure, but is it okay?
    :
    : thats all, thnx
    : {2}rIng
    :
    [green]
    Post that portion of your code and lets see.
    [/green]

Sign In or Register to comment.