Deleting a Leaf From a Tree Visually Explained

Dino Cajic
2 min readJun 19, 2020
Deleting a Leaf from a Tree

When deleting a leaf in the tree, the structure of the tree does not change. If we examine the tree below, the outlined nodes can be deleted safely without changing the overall structure of the tree.

The leaves circled in red can simply be removed without modifying the existing leaf structure. Nodes that pointed to the deleted leaf node will no longer point to that node.

You thought this would be a tediously long explanation? Nope. Like I try to reiterate through my articles, simplicity is key. Don’t overthink it. Computer Science topics, especially Algorithms, can be enjoyable as long as you see the simplicity in the topics.

If you liked what you read, my book, An Illustrative Introduction to Algorithms, covers this Algorithm and many more.

Read this article and others on my website:

--

--

Dino Cajic
Dino Cajic

Written by Dino Cajic

Author of An Illustrative Introduction to Algorithms. IT Leader with a B.S. in Computer Science, a minor in Biology, and a passion for learning.