![]() |
|
#1
|
|||
|
|||
Delete node in binary tree helpI have my program working except for deleting the node at the end and I am not sure my code is correct for the very bottom recursive call would someone help please. I am stuck.
CPP / C++ / C Code:
Last edited by LuciWiz : 09-Aug-2009 at 12:34.
Reason: Please insert your C++ code between [cpp] & [/cpp] tags
|
|||
|
#2
|
|||
|
|||
Re: Delete node in binary tree helpWhat you have posted is a bit sketchy.
You should try to post a small example that works as good as you can get it to show what you are trying to do. You say "deleting the node at the end " but your function looks like it is made to delete a specified node. Well I need the exercise so I got something together based on what you provided and it seems that YES your second recursive call works , but after that the function was hard to understand and incomplete so I rewrote it the way I would go about it. Note that I also changed that functions header. So see if this is close to what you are trying to do and maybe it will be helpful to you: CPP / C++ / C Code:
Code:
That could get to be one heck of a stack! It would seem to me that it would be quicker and less machine intensive to use a while loop to find the node... like the one I use to get to the beginning of th list: CPP / C++ / C Code:
Howard++; Last edited by Howard_L : 09-Aug-2009 at 23:50.
|
Recent GIDBlog
Install Adobe Flash - Without Administrator Rights by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Str_Misaligned in Double Link List | Peter_APIIT | C Programming Language | 1 | 29-Feb-2008 20:50 |
| help with header files and linked lists | raikenyuu | C Programming Language | 3 | 28-Jan-2008 10:06 |
| can anyone help me with my tree :) | bioeng_mtm | C++ Forum | 5 | 22-Apr-2006 12:50 |
| Strings tripping me up once more | Elsydeon | C++ Forum | 5 | 04-Dec-2005 17:41 |
| After execution - Error cannot locate /Skin File? | WSCH | C++ Forum | 1 | 05-Mar-2005 20:03 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The