hi all!

so i have an assignment for red black tree

i have to implement 2 functions and inside these function my prof said i need to inline implement 1 other function inside each

im having trouble with this(well actually im clueless)

can someone teach me where to insert the inline functions needed and also give me the correct declaration of it

i have done inline functions before but they were like this:

void link() { return link_field;}

but ive never done an inline that required many steps

heres my code

^ in this one i have to add the inline insertfixup() in here somewhere in here but i dont know where or howCode:bool Tree::insert(val_type x) { //PROBLEM FOR THE STUDENT treeNode* z = new treeNode; // create new node for insert z->data = x; // set insert data to z treeNode* y = NULL; treeNode* r = root; while(r != NULL) { // loop will go try to find a leaf to place the new node // if node is in tree already no insert is done y = r; if(z->data == y->data) return true; else if(z->data < y->data) r = r->left; else r = r->right; } z->parent = y; if(y == NULL) root = z; else if(z->data < y->data) y->left = z; else y->right = z; // now z node is a leaf and we set its "children" to nil z->left = NULL; z->right = NULL; // z is the new node inserted so it will be colored red z->red = true; return true; }

^ same thing im suppose to implement the treeSuccessor() but i dont know howCode:void Tree::remove(csc212::val_type x) { //PROBLEM FOR THE STUDENT treeNode* y; treeNode* z = search(x); treeNode* w; if(z->left == NULL || z->right == NULL) y = z; else y = treeSuccessor(z); if(y->left != NULL) w = y->left; else w = y->right; w->parent = y->parent; if(y->parent == NULL) root = x; else if(y == y->parent->left) y->parent->left = x; else y->parent->right = x; if(y != z) z->data = y->data; if(y->red == false) deleteFixup(w); }

anyone familiar with inline functions and rb trees please help!