| Welcome to UCR CS 14 Klefstad. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| remove return value | |
|---|---|
| Tweet Topic Started: Nov 13 2013, 12:27 PM (69 Views) | |
| Deleted User | Nov 13 2013, 12:27 PM Post #1 |
|
Deleted User
|
Sorry, maybe a stupid question, but what are we returning in the TreeNode *remove function? Are we returning the the TreeNode to remove for something else to delete it, are we deleting it inside the function and returning the head of the Tree, or is it something else entirely? |
|
|
| Deleted User | Nov 13 2013, 12:33 PM Post #2 |
|
Deleted User
|
I think it's really up to you. I used the return value more as a check for one of my special cases (the case where the root contained the value that needed to be removed) by having it return 0, else I just had it return the pointer to the node that had taken the old node's place. |
|
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Homework 6 · Next Topic » |





12:16 PM Jul 11