Tree: Postorder Traversal

  • + 0 comments

    You are more than likely to run out of memory trying to maintain the data structure than the recursive calls. If you use an assumption that a 64 bit machine uses a 64 bit pointer for the function address then you are pushing 16 bytes per call (8 bytes for the function address and 8 bytes for the heap address of the data object). When you use the stack object to store the data object you have the overhead of the stack object and if that stack object is not implemented correctly the possibility of the data object being passed by value and not by refernce. In this case that could be anywhere from 18 to 24 bytes per object (depending on the size of the int for the data).