CS 225 Lecture Notes - Lecture 25: Binary Tree

32 views2 pages

Document Summary

Mp5 available, due 11/1, 11:59p ec due 10/25, 11:59. // always passed by reference void dict::twochildremove(treenode *& croot) { // iop is a reference, must do this treenode * &iop = rightmostchild(croot->left); // reference to the return croot->key = iop->key; dremoval(iop); // when we do removal make sure you consider chain removals. // it"s possible for the predecessor has one other child. Binary search tree - remove, we"ll be using predecessor it can not have two children though, think about it. // if you can"t read your code, you should probably fix your code and break it into helper functions void dict::twochildremove(treenode *& croot) { // right most child of croot"s left subtree. // we know croot->left is not null cause we treenode * &iop = rightmostchild(croot->left); croot->key = iop->key; // replace data dremoval(iop); are in twochildremove. // dremoval will take care of everything else.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents