Hello, I have crated a binary tree template for school. And in my program implements this data structure, I have to have two trees, both of which are pointing to the same data, just in different orders.
The problem is, my template takes care of deleting the information, so when I delete one node, the pointer in the other tree is now pointing to unallocated memory. So I guess my question comes down to, is it okay to say “delete node” when it is already unallocated? I know it’s okay if you say “delete” to a NULL pointer, but what about a pointer that is pointing to unallocated memory?
The problem is, my template takes care of deleting the information, so when I delete one node, the pointer in the other tree is now pointing to unallocated memory. So I guess my question comes down to, is it okay to say “delete node” when it is already unallocated? I know it’s okay if you say “delete” to a NULL pointer, but what about a pointer that is pointing to unallocated memory?
Comment