Bifalgorithm post · Brisk · Chapter 1

How can we remove the Mal node while preserving the BST property?

How can we remove the Mal node while preserving the BST property? (Brisk · Chapter 1) — "Mal ” node from this tree, how would we do that? We can put the left-m…

Ideas in this flowchart

  • Removing Mal from a binary search tree
  • Replace Mal with the left-most node of Mal’s right subtree
  • The replacement node is River
  • Make Simon, with everything under him, Wash’s left child
  • These changes produce a Mal-less tree
  • The resulting tree contains River, Jayne, Inara, Kaylee, Zoe, Simon, and Wash
  • Check whether the resulting tree satisfies the BST property
  • The Mal-less tree satisfies the BST property
Feed/

How can we remove the Mal node while preserving the BST property?

Channel

Brisk

1 page

"Mal ” node from this tree, how would we do that? We can put the left-most node of Mal ’s right subtree (that would be River ) in Mal ’s place, and then make Simon (and everything under him) become Wash ’s left child. The result would look like this: River Jayne Inara Kaylee Zoe Simon Wash Take a moment and convince your- self that this Mal -less tree does in fact satisfy the BST property."

Flowchart preview
Series cover
👍
0
0 comments0 shares

Sign in to view and post comments.