Lets say for example I have a BST that is sorted by char names, using strcmp. IF greater than 0 go right else go left.
I.E (this is just an example, they are not inserted correctly)
1 2 3 4 5
/ \ / \
fish mouse zebra snake
I wanted to make a copy of this BST IF the length of the nodes are greater than the root, how would I approach this? I kinda started on this but I'm not sure if I'm making this more difficult than it should be.
void BST::copygreater(node * root, node *& dest, int & holder)
dest = NULL;
holder = strlen(root->name) + 1; //Don't know about this? If we do a recursive call then the value would change every call?
if(int length = strlen(root->name) + 1 > holder)
dest = new node;
dest->name = newchar[strlen(root->name) + 1];