<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BST insertion Archives - NeuralLantern.com</title>
	<atom:link href="https://www.NeuralLantern.com/tag/bst-insertion/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.NeuralLantern.com/tag/bst-insertion/</link>
	<description></description>
	<lastBuildDate>Mon, 27 Apr 2026 06:42:56 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>

<image>
	<url>https://www.NeuralLantern.com/wp-content/uploads/2025/04/cropped-2025-04-04-Lantern-03-32x32.png</url>
	<title>BST insertion Archives - NeuralLantern.com</title>
	<link>https://www.NeuralLantern.com/tag/bst-insertion/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Binary Search Tree Insertion Tutorial: Building a BST from Scratch Step by Step</title>
		<link>https://www.NeuralLantern.com/binary-search-tree-insertion-tutorial-building-a-bst-from-scratch-step-by-step/</link>
					<comments>https://www.NeuralLantern.com/binary-search-tree-insertion-tutorial-building-a-bst-from-scratch-step-by-step/#respond</comments>
		
		<dc:creator><![CDATA[mike]]></dc:creator>
		<pubDate>Mon, 27 Apr 2026 06:42:54 +0000</pubDate>
				<category><![CDATA[Binary Search Trees]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[binary search tree]]></category>
		<category><![CDATA[binary search tree tutorial]]></category>
		<category><![CDATA[binary tree]]></category>
		<category><![CDATA[BST insertion]]></category>
		<category><![CDATA[BST insertion step by step]]></category>
		<category><![CDATA[build BST from scratch]]></category>
		<category><![CDATA[coding interview prep]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[data structures]]></category>
		<category><![CDATA[inorder traversal]]></category>
		<category><![CDATA[self balancing trees]]></category>
		<category><![CDATA[time complexity BST]]></category>
		<category><![CDATA[tree height]]></category>
		<guid isPermaLink="false">https://www.NeuralLantern.com/?p=333</guid>

					<description><![CDATA[<p>Learn how to build a binary search tree (BST) by inserting numbers one by one. Follow the insertion process for the sequence 88, 21, 3, 6, 72, 34, 11, 1, 90, 65, 55, 17, 23, 9. See left/right decisions, pointer updates, inorder verification for sorted order, tree height calculation (6), and discussion of O(h) time complexity versus log n for balanced trees. Clear explanations without skipping steps.</p>
<p>The post <a href="https://www.NeuralLantern.com/binary-search-tree-insertion-tutorial-building-a-bst-from-scratch-step-by-step/">Binary Search Tree Insertion Tutorial: Building a BST from Scratch Step by Step</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="Binary Search Tree Insertion Tutorial: Building a BST from Scratch Step by Step" width="1380" height="776" src="https://www.youtube.com/embed/-vtcFOEkrEk?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">In this hands-on tutorial, we build a binary search tree (BST) from scratch by inserting numbers one by one: 88, 21, 3, 6, 72, 34, 11, 1, 90, 65, 55, 17, 23, and 9. Watch as each node finds its correct position following BST rules, with clear explanations of left and right child decisions, parent pointers, and why the tree ends up looking a bit wonky but is still valid.</p>



<p class="wp-block-paragraph">We cover the full insertion process, verify the tree is a proper BST by checking inorder traversal (sorted order), confirm it&#8217;s a connected acyclic rooted binary tree, and discuss tree height, time complexity (O(h) where h=6 for this tree), and why self-balancing trees matter for better performance.</p>



<p class="wp-block-paragraph">Great practice for computer science students, programmers learning data structures, or anyone prepping for coding interviews. No fancy animations &#8211; just real step-by-step drawing and reasoning.</p>



<p class="wp-block-paragraph">If you want more BST practice videos or specific insertion sequences, drop a comment below!</p>



<p class="wp-block-paragraph">00:00 Introduction to BST Practice<br>00:35 Insertion Sequence Overview<br>00:59 Rules for Building BST<br>01:30 Insert 88 as Root<br>02:20 Continue building the tree from input data<br>13:04 Finish building the tree<br>14:56 Clean Up Diagram<br>15:24 Verify Inorder Traversal<br>16:48 Confirm Tree Properties<br>19:23 Tree Height and Time Complexity<br>22:01 Search Example for 55<br>23:09 Log Time vs Actual Height<br>24:21 Conclusion and Future Topics</p>



<p class="wp-block-paragraph">=-=-=-=-=-=-=-=-=</p>



<p class="wp-block-paragraph">Thanks for watching!</p>



<p class="wp-block-paragraph">Find us on other social media here:</p>



<ul class="wp-block-list">
<li>https://www.NeuralLantern.com/social</li>



<li>Twitter / X: https://x.com/NeuralLantern</li>



<li>Rumble: https://rumble.com/c/c-3696939</li>



<li>BitChute: https://www.bitchute.com/channel/pg1Pvv5dN4Gt</li>



<li>Daily Motion: https://www.dailymotion.com/neurallantern</li>



<li>Minds: https://www.minds.com/neurallantern/</li>



<li>Odysee: https://odysee.com/@NeuralLantern:5</li>
</ul>



<p class="wp-block-paragraph">Please show your support!</p>



<ul class="wp-block-list">
<li>Buy me a coffee: https://ko-fi.com/neurallantern</li>



<li>Subscribe + Sharing on Social Media</li>



<li>Leave a comment or suggestion</li>



<li>Subscribe to the Blog: https://www.NeuralLantern.com</li>



<li>Watch the main &#8220;pinned&#8221; video of this channel for offers and extras</li>
</ul>



<p class="wp-block-paragraph">Hello there! Let&#8217;s practice constructing a binary search tree from scratch.</p>



<p class="wp-block-paragraph">In my previous video, we actually did this already, and in other previous videos we defined</p>



<p class="wp-block-paragraph">what is a binary search tree and some terminology and stuff like that, but I thought it would</p>



<p class="wp-block-paragraph">be nice to have two practice videos up. I&#8217;m willing to put more up if people want to make</p>



<p class="wp-block-paragraph">comments about more trees that they want to see inserted. For now, I&#8217;m just going to say</p>



<p class="wp-block-paragraph">we will add the following sequence of numbers. So this is a little diagram from the last time we</p>



<p class="wp-block-paragraph">did this. Let me just, oh, I&#8217;m supposed to make that full screen so it can be bigger. Whoops.</p>



<p class="wp-block-paragraph">Let me go ahead and add a new slide here. And then I&#8217;m going to do,</p>



<p class="wp-block-paragraph">Okay, so we&#8217;re going to try to add the following sequence of numbers.</p>



<p class="wp-block-paragraph">Like I said in my other video, don&#8217;t try to make the tree prettier.</p>



<p class="wp-block-paragraph">Don&#8217;t get mad if a number looks like it&#8217;s too far to the left or something.</p>



<p class="wp-block-paragraph">Just follow the normal rules of letting a node drop wherever it is supposed to drop</p>



<p class="wp-block-paragraph">according to the rules of building a binary search tree.</p>



<p class="wp-block-paragraph">So the first thing that I&#8217;m going to do is maybe draw a little arrow here.</p>



<p class="wp-block-paragraph">I&#8217;m going to do like a pink arrow to indicate, you know,</p>



<p class="wp-block-paragraph">You know, well, maybe I&#8217;ll do like a red one to indicate which number we&#8217;re actually trying to add at the moment.</p>



<p class="wp-block-paragraph">So it&#8217;s going to be the 88 first.</p>



<p class="wp-block-paragraph">Let&#8217;s see, we&#8217;ll put that right there.</p>



<p class="wp-block-paragraph">And then now let&#8217;s say that the 88 is going to drop into our tree somewhere.</p>



<p class="wp-block-paragraph">First question we have to ask ourselves is do we have a root node?</p>



<p class="wp-block-paragraph">We don&#8217;t have a root node, which means the number we&#8217;re trying to add should be the root node.</p>



<p class="wp-block-paragraph">And that&#8217;s it.</p>



<p class="wp-block-paragraph">So I&#8217;m going to draw like a little circle here, a little node.</p>



<p class="wp-block-paragraph">and I&#8217;m going to stick the number 88 inside of it we&#8217;re using integer t types</p>



<p class="wp-block-paragraph">if you recall the last videos these nodes are supposed to be able to hold</p>



<p class="wp-block-paragraph">almost any data type that you want they don&#8217;t have to be numbers but I&#8217;m just</p>



<p class="wp-block-paragraph">going to use numbers for the sake of this example because it&#8217;s easier so I&#8217;m</p>



<p class="wp-block-paragraph">going to say this is our root node it&#8217;s at the very top of the tree and we&#8217;re</p>



<p class="wp-block-paragraph">done adding 88 and that&#8217;s it next step we&#8217;re going to add the 21 so I&#8217;m just</p>



<p class="wp-block-paragraph">forward a little bit here and the 21 same question do we have a root node we currently do so that</p>



<p class="wp-block-paragraph">means we can&#8217;t actually put the 21 there so we have to make a decision does the 21 belong on the</p>



<p class="wp-block-paragraph">left or the right of the 88 the 21 is less than 88 which means it belongs on the left side so i&#8217;m</p>



<p class="wp-block-paragraph">just going to duplicate this and try to make a pretty diagram by sort of splitting the difference</p>



<p class="wp-block-paragraph">in terms of the empty space on the left between the edge of the screen and the existing root node</p>



<p class="wp-block-paragraph">and make sure that it goes down, you know, a full rank, you know, at least the full height of a node,</p>



<p class="wp-block-paragraph">maybe a little bit more, but you want to keep all same depth nodes on the same Y coordinate.</p>



<p class="wp-block-paragraph">It&#8217;s just easier to debug your diagrams that way.</p>



<p class="wp-block-paragraph">This one&#8217;s actually probably going to get messy. I might have to readjust this a few times.</p>



<p class="wp-block-paragraph">I think I recalled these were, these might&#8217;ve been bad numbers. I can&#8217;t remember.</p>



<p class="wp-block-paragraph">Okay. So the 21 is going to be the left child of the 88 because it belongs on the left side.</p>



<p class="wp-block-paragraph">So I&#8217;m just going to do my little connecting line here.</p>



<p class="wp-block-paragraph">connecting line here now 21 has a parent of 88 and 88 has a left child of 21 and we&#8217;re done adding</p>



<p class="wp-block-paragraph">the 21 so i&#8217;m going to move the arrow to the three we&#8217;re now trying to add the three node</p>



<p class="wp-block-paragraph">again we look at the root node we say okay that&#8217;s occupied so we can&#8217;t use that does three belong on</p>



<p class="wp-block-paragraph">the left or the right of the 88 well it&#8217;s less than 88 so it belongs on the left the left child</p>



<p class="wp-block-paragraph">again, does the three belong on the left or the right of the 21? It belongs on the left</p>



<p class="wp-block-paragraph">because it&#8217;s less than 21 and the left child of 21 is currently doesn&#8217;t exist. It&#8217;s null.</p>



<p class="wp-block-paragraph">So that means the three is going to be the new left child of the 21 node. Maybe just put it</p>



<p class="wp-block-paragraph">like right there, put the three there. And then I&#8217;m going to do the connecting line in your code.</p>



<p class="wp-block-paragraph">You can imagine that the left child pointer of the 21 node has now been set. So it&#8217;s pointing</p>



<p class="wp-block-paragraph">been set so it&#8217;s pointing to the brand new node we just made for the three and then inside of the</p>



<p class="wp-block-paragraph">three node its parent pointer is pointing to the 21 node okay so we&#8217;re done adding the three we</p>



<p class="wp-block-paragraph">move on to the six same thing that we did before we look at the root node uh the six belongs on</p>



<p class="wp-block-paragraph">the left so i&#8217;m gonna say go to the left the 21 node is it&#8217;s there it&#8217;s occupied so we have to</p>



<p class="wp-block-paragraph">left of 21 because it&#8217;s less than 21 we go down to the left then we look at the three that&#8217;s also</p>



<p class="wp-block-paragraph">occupied does the six belong on the left or right of three it belongs on the right side of three</p>



<p class="wp-block-paragraph">because it&#8217;s greater than three so that means the sixth node is going to be the right child</p>



<p class="wp-block-paragraph">of three again try to split the difference these diagrams get ugly fast i really</p>



<p class="wp-block-paragraph">i don&#8217;t i don&#8217;t want to rearrange the topology but i&#8217;m probably gonna have to</p>



<p class="wp-block-paragraph">I think I&#8217;m like crashing out here.</p>



<p class="wp-block-paragraph">Oh, no.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">Nope.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">Let me try one more time.</p>



<p class="wp-block-paragraph">These lines are killing me.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">I&#8217;m just going to update the three to a six and leave a little gap on that line.</p>



<p class="wp-block-paragraph">It&#8217;s fine.</p>



<p class="wp-block-paragraph">Now we&#8217;re ready to try to add the 72 node.</p>



<p class="wp-block-paragraph">We have a little relief here because this is not like a smaller and smaller number that we&#8217;re dealing with.</p>



<p class="wp-block-paragraph">So, well, we just look at the root node.</p>



<p class="wp-block-paragraph">72 belongs on the left side so I&#8217;m going to hop to the left here we then look at</p>



<p class="wp-block-paragraph">the 21 72 belongs on the right side because it&#8217;s greater than 21 so that</p>



<p class="wp-block-paragraph">means 72 is going to be the right child of 21 so I&#8217;m just going to select this</p>



<p class="wp-block-paragraph">make a duplicate try to keep the three and the six at the same you know y</p>



<p class="wp-block-paragraph">coordinate because they&#8217;re on the same descendancy rank they&#8217;re at the same</p>



<p class="wp-block-paragraph">you know generation whatever you want to call it so I&#8217;m going to put the 72 on</p>



<p class="wp-block-paragraph">And then I&#8217;m going to do our connecting line, indicating that both nodes now have pointers that refer to each other.</p>



<p class="wp-block-paragraph">Okay, we&#8217;re done adding the 72.</p>



<p class="wp-block-paragraph">I&#8217;m going to move this to the right a little bit.</p>



<p class="wp-block-paragraph">And then, oops, get rid of that little dot.</p>



<p class="wp-block-paragraph">Now we&#8217;re ready to add the 34.</p>



<p class="wp-block-paragraph">So the 34, we look at the 88 node occupied.</p>



<p class="wp-block-paragraph">We go left.</p>



<p class="wp-block-paragraph">We look at the 21 node.</p>



<p class="wp-block-paragraph">34 belongs on the right side of 21.</p>



<p class="wp-block-paragraph">of 21 so then we look at the 72 34 belongs on the left side of 72 so that means 34 is going to be</p>



<p class="wp-block-paragraph">the left child of 72 so I&#8217;m going to select one of these nodes and duplicate it and say that</p>



<p class="wp-block-paragraph">you have a left child of 72 now and it&#8217;s going to be the 34 node do my pointer connection real fast</p>



<p class="wp-block-paragraph">I haven&#8217;t been duplicating the pages. Okay. So, uh, I guess that&#8217;s just for me.</p>



<p class="wp-block-paragraph">We&#8217;ll move on to adding the 11 node.</p>



<p class="wp-block-paragraph">So we add the 11 node by looking at the root node first.</p>



<p class="wp-block-paragraph">11 belongs on the left side. We then look at the 21,</p>



<p class="wp-block-paragraph">11 belongs on the left of 21. Go to the left here. We look at the three,</p>



<p class="wp-block-paragraph">11 belongs on the right of the three. We go to the right,</p>



<p class="wp-block-paragraph">11 belongs on the right of the six node.</p>



<p class="wp-block-paragraph">This is definitely a gross graph at this point.</p>



<p class="wp-block-paragraph">at this point. So I&#8217;m going to duplicate this node here and try to split the difference between</p>



<p class="wp-block-paragraph">the six and the 21 in terms of like the free space. So I&#8217;m just going to drag this down a</p>



<p class="wp-block-paragraph">little bit there and say that 11 goes as the new right child of the six node. So</p>



<p class="wp-block-paragraph">just do that. This is a gross diagram. I might want to redraw this later.</p>



<p class="wp-block-paragraph">Now we&#8217;re ready to try to add the one node.</p>



<p class="wp-block-paragraph">the one again we look at the root node of the tree and it&#8217;s occupied so we can&#8217;t put it there</p>



<p class="wp-block-paragraph">we go to the left we go to the left again and the one belongs on the left of the three nodes so we</p>



<p class="wp-block-paragraph">have a little bit more room there so that&#8217;s good i&#8217;m gonna copy this node and make it the new left</p>



<p class="wp-block-paragraph">child of the three i&#8217;m gonna like say that our one is right there and then i&#8217;m gonna do the connecting line</p>



<p class="wp-block-paragraph">okay all right we&#8217;re done adding the one now I&#8217;m gonna add the 90 node oh this is</p>



<p class="wp-block-paragraph">gonna be nice and easy because the 90 definitely belongs on the right side of</p>



<p class="wp-block-paragraph">the 80 node whoops what happened okay sorry for making that noise I&#8217;m gonna</p>



<p class="wp-block-paragraph">duplicate this node here and make it the right child of the 88 node so let&#8217;s see</p>



<p class="wp-block-paragraph">kind of even there. So we&#8217;re going to put 90 right there. And then I&#8217;m going to do a connecting line</p>



<p class="wp-block-paragraph">in blue. Now we&#8217;re done adding the 90.</p>



<p class="wp-block-paragraph">So then we&#8217;re going to add the 65. 65 belongs on the left of the 88 node.</p>



<p class="wp-block-paragraph">So we&#8217;re kind of in left territory now. It&#8217;s kind of sucky again.</p>



<p class="wp-block-paragraph">And bounce down to the left. 66 belongs on the right side of the 21 node. So we look at the 72.</p>



<p class="wp-block-paragraph">look at the 72 it belongs on the left of the 72 we go there it belongs on the right of the 34 so we</p>



<p class="wp-block-paragraph">go right here as the new right child and the diagram kind of sucks at this point it&#8217;s a little</p>



<p class="wp-block-paragraph">cramped but i&#8217;m going to try my best to split the difference between the 34 and the 32 visually to</p>



<p class="wp-block-paragraph">make a nice easy to debug graph so maybe like somewhere around there put 66 then i&#8217;m going to</p>



<p class="wp-block-paragraph">So the 66 is now the right child of 34.</p>



<p class="wp-block-paragraph">Okay, next number that we&#8217;re going to add is my computer&#8217;s crashing.</p>



<p class="wp-block-paragraph">Hello?</p>



<p class="wp-block-paragraph">What happened?</p>



<p class="wp-block-paragraph">There we go.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">So we&#8217;re ready to add the 55.</p>



<p class="wp-block-paragraph">Oh, God.</p>



<p class="wp-block-paragraph">Okay, let me see what&#8217;s going to happen here.</p>



<p class="wp-block-paragraph">This is awful.</p>



<p class="wp-block-paragraph">is awful i usually say you have to space these out enough so that none of these overlap but</p>



<p class="wp-block-paragraph">they&#8217;re about to overlap okay we&#8217;ll do go to the left because 55 is less than 88 go to the right</p>



<p class="wp-block-paragraph">because 55 is greater than 21 go to the left because it&#8217;s less than 72 go to the right because</p>



<p class="wp-block-paragraph">it&#8217;s greater than 34 then go to the left again because it&#8217;s less than 66 i hate this i hate this</p>



<p class="wp-block-paragraph">between 34 and 66, just to try to make it easier to debug.</p>



<p class="wp-block-paragraph">This is almost, I&#8217;m almost stretched</p>



<p class="wp-block-paragraph">to my mental limit right now.</p>



<p class="wp-block-paragraph">So I&#8217;m gonna make the left child pointer here</p>



<p class="wp-block-paragraph">and the new node we just added was 55.</p>



<p class="wp-block-paragraph">Whoops, yeah, 55.</p>



<p class="wp-block-paragraph">Okay, my God.</p>



<p class="wp-block-paragraph">Let me just duplicate this one more time</p>



<p class="wp-block-paragraph">and get rid of those pink arrows.</p>



<p class="wp-block-paragraph">arrows let&#8217;s add the 17 next 17 right here um so once again we look at the root node it&#8217;s occupied</p>



<p class="wp-block-paragraph">go to the left because it&#8217;s less than we look at the 21 we go left because it&#8217;s less than 21</p>



<p class="wp-block-paragraph">we go to the right because it&#8217;s greater than three we look at the six we go to the right</p>



<p class="wp-block-paragraph">because it&#8217;s greater than six we go to the right because it&#8217;s greater than 11.</p>



<p class="wp-block-paragraph">So a super cramped diagram.</p>



<p class="wp-block-paragraph">I&#8217;m in hell.</p>



<p class="wp-block-paragraph">I&#8217;m just going to move this slightly to the right because this is just awful.</p>



<p class="wp-block-paragraph">And I&#8217;m going to try to make sure again that same depth nodes are at the same Y coordinate.</p>



<p class="wp-block-paragraph">Let me fix that number real fast before I forget.</p>



<p class="wp-block-paragraph">And put it as a 17.</p>



<p class="wp-block-paragraph">And then do my connecting line.</p>



<p class="wp-block-paragraph">Like that.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">I&#8217;m losing it.</p>



<p class="wp-block-paragraph">The, uh, whoops, the 23, where is this going to go?</p>



<p class="wp-block-paragraph">Is it 23?</p>



<p class="wp-block-paragraph">Um, Hmm.</p>



<p class="wp-block-paragraph">Hmm.</p>



<p class="wp-block-paragraph">Oh, well, it&#8217;s going to be like left child of the 34 probably.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">Let me just, uh, look at the root node.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">23 belongs on the left of that.</p>



<p class="wp-block-paragraph">Look at the 21, 23 belongs on the right of that.</p>



<p class="wp-block-paragraph">Cause it&#8217;s greater than 21.</p>



<p class="wp-block-paragraph">Look at the 72.</p>



<p class="wp-block-paragraph">It belongs on the left.</p>



<p class="wp-block-paragraph">it belongs on the left look at the 34 belongs on the left and then that&#8217;s going to be the new left</p>



<p class="wp-block-paragraph">child okay so I&#8217;m going to duplicate one of these nodes and it&#8217;s going to be the new left child of</p>



<p class="wp-block-paragraph">the 34 node that is awful but I guess we barely have enough room let me change that to a 23 and</p>



<p class="wp-block-paragraph">then I&#8217;ll add my connecting line okay and now we&#8217;re ready to add the final value in our tree</p>



<p class="wp-block-paragraph">to be? It&#8217;s going to be like left child of 11 maybe. So we look at the root node. Whoops,</p>



<p class="wp-block-paragraph">forgot to move that arrow. We look at the root node. We can&#8217;t put it there. Nine belongs on the</p>



<p class="wp-block-paragraph">left side of the root. So we go like that. Nine belongs on the left side of the 21. Oh, did I just</p>



<p class="wp-block-paragraph">guess something wrong? No, no, no. I think I&#8217;m okay. Go to the left side of that. We look at</p>



<p class="wp-block-paragraph">right side of three we look at the six nine belongs on the right side of the six we look at</p>



<p class="wp-block-paragraph">the eleven nine belongs on the left side of eleven because it&#8217;s less than eleven so I&#8217;m just going to</p>



<p class="wp-block-paragraph">duplicate this and it&#8217;s going to end up being the left side whoops nope that&#8217;s wrong hang on a second</p>



<p class="wp-block-paragraph">let me oh come on man let me get this down it&#8217;s going to be the left child of eleven not the left</p>



<p class="wp-block-paragraph">there and the diagram is a little messed up maybe I should try to rearrange this in a second</p>



<p class="wp-block-paragraph">it the topology is correct but it&#8217;s harder to debug because you can see that one of the right</p>



<p class="wp-block-paragraph">descendants of the six node is actually physically on its left side and that just makes it extra hard</p>



<p class="wp-block-paragraph">to debug but for now we&#8217;ll say that we&#8217;re done adding stuff into the tree so maybe I can kind</p>



<p class="wp-block-paragraph">I&#8217;m not going to change the actual topology.</p>



<p class="wp-block-paragraph">I&#8217;m just going to like, you know, redraw this in a slightly nicer way.</p>



<p class="wp-block-paragraph">So I can probably take this whole subtree and move it over to the left a little bit to make it a little cleaner.</p>



<p class="wp-block-paragraph">Which will give me some room to move this subtree a little bit over to the right.</p>



<p class="wp-block-paragraph">Am I still wearing my microphone? Yeah.</p>



<p class="wp-block-paragraph">And then it&#8217;s a little bit cleaner.</p>



<p class="wp-block-paragraph">Then I just have to redraw this line.</p>



<p class="wp-block-paragraph">Whoops.</p>



<p class="wp-block-paragraph">oops yeah just have to redraw this line and now i think we&#8217;re following the rules that i talked</p>



<p class="wp-block-paragraph">about before where a good diagram has all the left descendants physically on the left side of</p>



<p class="wp-block-paragraph">a given node so let&#8217;s see the six has everything on the right and everything i think we&#8217;re okay</p>



<p class="wp-block-paragraph">i&#8217;m going to duplicate this real fast and now let&#8217;s verify that our tree is actually correct</p>



<p class="wp-block-paragraph">So I said this in the last video when we built a tree, but you basically want to take like the input data set here and sort it.</p>



<p class="wp-block-paragraph">And whatever sorted list you end up with, that&#8217;s what you should see when you scan your eyes from left to right.</p>



<p class="wp-block-paragraph">Again, this is another good argument for drawing the diagram in a really good way.</p>



<p class="wp-block-paragraph">All left descendants are physically on the left. All right descendants are physically on the right.</p>



<p class="wp-block-paragraph">So another way that I could do this, besides I don&#8217;t really want to sort this list right now,</p>



<p class="wp-block-paragraph">Just scan from left to right and make sure that I see increasing numbers</p>



<p class="wp-block-paragraph">Or if you&#8217;ve decided to make a tree that supports duplicates, make sure that you see non-decreasing numbers</p>



<p class="wp-block-paragraph">But I&#8217;m looking for an ascending list</p>



<p class="wp-block-paragraph">Okay, so I&#8217;m gonna just like do little hashes here</p>



<p class="wp-block-paragraph">One is the lowest number. That&#8217;s good. Then if I go to the right just a little bit</p>



<p class="wp-block-paragraph">I see a three go to the right a little bit. I see a six that&#8217;s still increasing then I see a nine and then I see an 11</p>



<p class="wp-block-paragraph">still been increasing go to the right a little bit more it&#8217;s a 21 go to the right a little bit more</p>



<p class="wp-block-paragraph">it&#8217;s a 23 then it&#8217;s a 34 then it&#8217;s a 55 then it&#8217;s a 66 then it&#8217;s a 72 so far everything&#8217;s been</p>



<p class="wp-block-paragraph">increasing and then from 72 to 88 and from 88 to 90. so the ordering of the numbers are correct</p>



<p class="wp-block-paragraph">let me just make sure i actually have a binary search tree by the definition of a bst first it</p>



<p class="wp-block-paragraph">crazy lines going off in some direction or like different symbols this is a</p>



<p class="wp-block-paragraph">connected graph meaning I could probably find well I definitely could find a path</p>



<p class="wp-block-paragraph">from any node to any other node if I just you know trace the edges so can the</p>



<p class="wp-block-paragraph">9 find its way to the 90 yeah if we just kind of like go you know up this way and</p>



<p class="wp-block-paragraph">follow the edges up to the 88 and then back down to the 90 so every single node</p>



<p class="wp-block-paragraph">could do that it could find every single other node on the graph which means this</p>



<p class="wp-block-paragraph">every single other node on the graph which means this is a connected graph so that&#8217;s good the next</p>



<p class="wp-block-paragraph">thing is now that we have a connected graph do we have a tree so check for cycles uh can any start</p>



<p class="wp-block-paragraph">node find its way back to itself in a path that does not repeat edges i don&#8217;t see that anywhere</p>



<p class="wp-block-paragraph">in the tree so i think we have a valid tree let me get rid of that real fast so for example uh</p>



<p class="wp-block-paragraph">Could we find a path that goes away from the 9 node and then comes back without repeating any edges?</p>



<p class="wp-block-paragraph">I cannot because as soon as we go out to the 11,</p>



<p class="wp-block-paragraph">later on we would have to use that same edge to come back down to the 9 and that would be repeating an edge.</p>



<p class="wp-block-paragraph">So we just kind of check that for every single node.</p>



<p class="wp-block-paragraph">We can&#8217;t find a cycle anywhere in this entire graph.</p>



<p class="wp-block-paragraph">So this is an acyclic graph.</p>



<p class="wp-block-paragraph">Okay, that means it&#8217;s a tree.</p>



<p class="wp-block-paragraph">Is this a rooted tree?</p>



<p class="wp-block-paragraph">ancestor to all other nodes and it&#8217;s that 88 node that&#8217;s the root node of the</p>



<p class="wp-block-paragraph">entire tree every single node in the tree can say that 88 is its greatest</p>



<p class="wp-block-paragraph">ancestor there&#8217;s no you know same leveled nodes at the very very very top okay so</p>



<p class="wp-block-paragraph">this is a rooted tree now is it a binary tree yeah we look at every single node</p>



<p class="wp-block-paragraph">and we can see that none of the nodes have more than two children they&#8217;ve all</p>



<p class="wp-block-paragraph">this is a binary tree. And then when we, you know, we verified the numbers a second ago,</p>



<p class="wp-block-paragraph">that means this is a binary search tree. So it satisfies all the properties of a binary search</p>



<p class="wp-block-paragraph">tree. It doesn&#8217;t look very good. It&#8217;s kind of wonky, but it is valid. Remember this,</p>



<p class="wp-block-paragraph">you know, a binary search tree just by itself is not a self-balancing tree,</p>



<p class="wp-block-paragraph">which means you, you, you need to like not inject your human feelings into the tree while you&#8217;re</p>



<p class="wp-block-paragraph">building it and start rearranging it to make it prettier. It wouldn&#8217;t be a valid binary search</p>



<p class="wp-block-paragraph">if you tried to add special rules when you were creating it.</p>



<p class="wp-block-paragraph">I don&#8217;t know.</p>



<p class="wp-block-paragraph">If you imagine that maybe you, the human,</p>



<p class="wp-block-paragraph">were changing the input data,</p>



<p class="wp-block-paragraph">then I guess that&#8217;s valid.</p>



<p class="wp-block-paragraph">But don&#8217;t imagine that the tree</p>



<p class="wp-block-paragraph">is changing the data as you add it.</p>



<p class="wp-block-paragraph">Anyway, so how fast is this tree?</p>



<p class="wp-block-paragraph">Remember we said in a previous video</p>



<p class="wp-block-paragraph">that a perfect binary search tree,</p>



<p class="wp-block-paragraph">meaning perfectly balanced on every single node,</p>



<p class="wp-block-paragraph">would be a log time tree.</p>



<p class="wp-block-paragraph">It would be really, really fast to add and search</p>



<p class="wp-block-paragraph">to add and search and even remove but this tree is definitely lopsided so this</p>



<p class="wp-block-paragraph">is not a log tree the time complexity of a binary search tree actually is not</p>



<p class="wp-block-paragraph">really log because the tree could just grow in any direction so in the worst</p>



<p class="wp-block-paragraph">case scenario if you add the worst possible data you&#8217;d end up with a linear</p>



<p class="wp-block-paragraph">time tree self balancing trees will be log time trees because they always</p>



<p class="wp-block-paragraph">rearrange themselves to make sure that they&#8217;re balanced to a certain extent but</p>



<p class="wp-block-paragraph">But, you know, as a binary search tree scales, it could just get slower and slower and slower.</p>



<p class="wp-block-paragraph">So we wouldn&#8217;t be able to say that BSTs, binary search trees in general are log time.</p>



<p class="wp-block-paragraph">We could pull up a calculator though and we could say, well, you know, what&#8217;s the height of this particular tree?</p>



<p class="wp-block-paragraph">Let me just look at the depths real fast here.</p>



<p class="wp-block-paragraph">What&#8217;s the height of this tree?</p>



<p class="wp-block-paragraph">So the root node has a depth of zero and then one and then two and then three and then four.</p>



<p class="wp-block-paragraph">drawing your tree in a nice pretty way where all the ranks are the same physically.</p>



<p class="wp-block-paragraph">We just take the deepest node and we add one to it and we say that&#8217;s the height.</p>



<p class="wp-block-paragraph">So the height of this tree is six.</p>



<p class="wp-block-paragraph">Another way of looking at it is if we wanted to touch one of the deepest nodes,</p>



<p class="wp-block-paragraph">how many nodes would we have to touch as we travel down through the tree?</p>



<p class="wp-block-paragraph">So how many nodes would we have to touch to find, you know, the nine or the 17 or the 55?</p>



<p class="wp-block-paragraph">one node the 88 two and let&#8217;s go to the left three four five six we&#8217;d have to touch six nodes</p>



<p class="wp-block-paragraph">to get to the deepest node so that&#8217;s why we&#8217;re saying that&#8217;s another way that we&#8217;re justifying</p>



<p class="wp-block-paragraph">that we say the height is six so the height of this tree is six which means in the worst case</p>



<p class="wp-block-paragraph">scenario if we needed to search this tree again we&#8217;ll talk about actually searching in another</p>



<p class="wp-block-paragraph">video but for now i can just promise you that if we were going to search this tree we could do it</p>



<p class="wp-block-paragraph">going to search this tree we could do it in at most six uh examinations so even though we have</p>



<p class="wp-block-paragraph">a lot of nodes here how many nodes do we actually have let me just double check this we have n</p>



<p class="wp-block-paragraph">is equal to one two three four five six seven eight nine ten eleven twelve thirteen fourteen</p>



<p class="wp-block-paragraph">we have fourteen nodes but at most we&#8217;d have to examine six nodes because this is a binary search</p>



<p class="wp-block-paragraph">tree so it&#8217;s a lot faster than scanning the whole tree in linear time but it could be a lot faster</p>



<p class="wp-block-paragraph">It could be a lot faster if the tree was better balanced.</p>



<p class="wp-block-paragraph">That&#8217;s a topic for another day.</p>



<p class="wp-block-paragraph">So for example, if we wanted to search for the number 55, let&#8217;s say we were just going</p>



<p class="wp-block-paragraph">to search for 55, you know, we&#8217;d look at the 88.</p>



<p class="wp-block-paragraph">Basically searching is pretty much the same as adding a node.</p>



<p class="wp-block-paragraph">You just kind of go find where the node would belong.</p>



<p class="wp-block-paragraph">And then if it&#8217;s there, then you found it.</p>



<p class="wp-block-paragraph">And if not, then it&#8217;s not in there.</p>



<p class="wp-block-paragraph">55 belongs on the left of 88, belongs on the right of 21, it belongs on the left of 72.</p>



<p class="wp-block-paragraph">belongs on the left of 72, belongs on the right of 34, belongs on the left of 66, and there we</p>



<p class="wp-block-paragraph">found it. Notice how we only did one, two, three, four, five, six examinations. So I&#8217;m going to talk</p>



<p class="wp-block-paragraph">about big O and time complexities in another video, but long story short, the time complexity</p>



<p class="wp-block-paragraph">of this particular tree, or actually any binary search tree, is always going to be O of H, no</p>



<p class="wp-block-paragraph">imbalanced or perfectly balanced O of H so in the worst case scenario since H is 6 we&#8217;re going to have to touch H or 6 nodes</p>



<p class="wp-block-paragraph">To search or add something or whatever if the tree was perfect. It would look more like log time. Let&#8217;s pull up that calculator real fast</p>



<p class="wp-block-paragraph">Where the heck is my calculator? I think I like got sidetracked</p>



<p class="wp-block-paragraph">so if I pull up a calculator here</p>



<p class="wp-block-paragraph">and I typed in</p>



<p class="wp-block-paragraph">log base 2 it&#8217;s base 2 because we only allow two children per node at most log</p>



<p class="wp-block-paragraph">base 2 of the number of nodes in the tree so log base 2 of 14 if we get the</p>



<p class="wp-block-paragraph">answer to that it says 3.8 which means the calculator is telling us that in a</p>



<p class="wp-block-paragraph">log time tree we should not have to examine more than four nodes in order to</p>



<p class="wp-block-paragraph">search the tree or add a brand new node but this is not a log tree because it is</p>



<p class="wp-block-paragraph">totally imbalanced it&#8217;s kind of wonky it&#8217;s not it&#8217;s not perfect so it&#8217;s telling us in a perfect</p>



<p class="wp-block-paragraph">tree we&#8217;d have to touch four nodes only but we clearly know we might have to touch six nodes in</p>



<p class="wp-block-paragraph">the worst case so that i&#8217;m just trying to bring to your attention that the more imbalanced the tree is</p>



<p class="wp-block-paragraph">the further its uh performance drifts away from log time which is a great argument</p>



<p class="wp-block-paragraph">I think this is pretty much everything I wanted to talk about today.</p>



<p class="wp-block-paragraph">I&#8217;m going to take a break and like, you know, eat some cookies and stuff.</p>



<p class="wp-block-paragraph">But in a future video, we&#8217;re going to talk about inserting.</p>



<p class="wp-block-paragraph">No, we already just did that literally right now.</p>



<p class="wp-block-paragraph">We&#8217;re going to talk about searching through the tree.</p>



<p class="wp-block-paragraph">We&#8217;re going to talk about removing nodes from the tree.</p>



<p class="wp-block-paragraph">We&#8217;re going to talk about linear trees.</p>



<p class="wp-block-paragraph">We&#8217;re going to talk about all the time complexities.</p>



<p class="wp-block-paragraph">And then eventually we&#8217;ll move on to self-balancing trees.</p>



<p class="wp-block-paragraph">on to self-balancing trees. So I hope you had fun watching this video. I hope you learned a little</p>



<p class="wp-block-paragraph">bit of stuff and I&#8217;ll see you at a later date in time. I&#8217;m outie. Patowdy. Note to self, edit out</p>



<p class="wp-block-paragraph">Patowdy. Hey everybody, thanks for watching this video again from the bottom of my heart. I really</p>



<p class="wp-block-paragraph">hope you did learn something and have some fun if you could do me a please a small little favor</p>



<p class="wp-block-paragraph">could you please subscribe and follow this channel or these videos or whatever it is you do on the</p>



<p class="wp-block-paragraph">current social media website that you&#8217;re looking at right now it would really mean the world to me</p>



<p class="wp-block-paragraph">and it&#8217;ll help make more videos and grow this community so we&#8217;ll be able to do more videos</p>



<p class="wp-block-paragraph">longer videos better videos or just i&#8217;ll be able to keep making videos in general so please</p>



<p class="wp-block-paragraph">and subscribe. You know, sometimes I&#8217;m sleeping in the middle of the night and I just wake up</p>



<p class="wp-block-paragraph">because I know somebody subscribed or followed. It just wakes me up and I get filled with joy.</p>



<p class="wp-block-paragraph">That&#8217;s exactly what happens every single time. So you could do it as a nice favor to me or you</p>



<p class="wp-block-paragraph">could, you could troll me if you want to just wake me up in the middle of the night, just subscribe</p>



<p class="wp-block-paragraph">and then I&#8217;ll, I&#8217;ll just wake up. I promise that&#8217;s what will happen. Also, uh, if you look at the</p>



<p class="wp-block-paragraph">middle of the screen right now, you should see a QR code, which you can scan in order to go to the</p>



<p class="wp-block-paragraph">we&#8217;re at the bottom of this video and it&#8217;ll take you to my main website where you can just kind of</p>



<p class="wp-block-paragraph">like see all the videos i published and the services and tutorials and things that i offer</p>



<p class="wp-block-paragraph">and all that good stuff and uh if you have a suggestion for uh uh clarifications or errata</p>



<p class="wp-block-paragraph">or just future videos that you want to see please leave a comment or if you just want to say hey</p>



<p class="wp-block-paragraph">what&#8217;s up what&#8217;s going on you know just send me a comment whatever i also wake up for those in the</p>



<p class="wp-block-paragraph">wake up in a cold sweat and i&#8217;m like it would really it really mean the world to me i would</p>



<p class="wp-block-paragraph">really appreciate it so again thank you so much for watching this video and um enjoy the cool music</p>



<p class="wp-block-paragraph">as as i fade into the darkness which is coming for us all</p>



<p class="wp-block-paragraph">Thank you.</p>
<p>The post <a href="https://www.NeuralLantern.com/binary-search-tree-insertion-tutorial-building-a-bst-from-scratch-step-by-step/">Binary Search Tree Insertion Tutorial: Building a BST from Scratch Step by Step</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.NeuralLantern.com/binary-search-tree-insertion-tutorial-building-a-bst-from-scratch-step-by-step/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Building a Binary Search Tree &#8211; Insertion Tutorial</title>
		<link>https://www.NeuralLantern.com/building-a-binary-search-tree-insertion-tutorial/</link>
					<comments>https://www.NeuralLantern.com/building-a-binary-search-tree-insertion-tutorial/#respond</comments>
		
		<dc:creator><![CDATA[mike]]></dc:creator>
		<pubDate>Sun, 12 Apr 2026 05:12:30 +0000</pubDate>
				<category><![CDATA[Binary Search Trees]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[binary search tree]]></category>
		<category><![CDATA[binary search tree example]]></category>
		<category><![CDATA[binary search tree tutorial]]></category>
		<category><![CDATA[binary tree insertion]]></category>
		<category><![CDATA[BST depth]]></category>
		<category><![CDATA[BST from scratch]]></category>
		<category><![CDATA[BST height]]></category>
		<category><![CDATA[BST insertion]]></category>
		<category><![CDATA[build binary search tree]]></category>
		<category><![CDATA[computer science tutorial]]></category>
		<category><![CDATA[data structures]]></category>
		<category><![CDATA[data structures and algorithms]]></category>
		<category><![CDATA[in order traversal]]></category>
		<category><![CDATA[insert into binary search tree]]></category>
		<guid isPermaLink="false">https://www.NeuralLantern.com/?p=330</guid>

					<description><![CDATA[<p>In this tutorial we build a binary search tree together by inserting the numbers 73, 98, 12, 45, 67, 10, 43, 11, 99, and 32 one by one. Starting from an empty tree, each number is placed according to binary search tree rules: smaller values go left, larger values go right. We let the nodes fall where they belong without any rearranging, resulting in a realistic (and slightly lopsided) BST. The video explains tree depth, height, and confirms the final structure maintains all BST properties with a properly sorted in-order traversal.</p>
<p>The post <a href="https://www.NeuralLantern.com/building-a-binary-search-tree-insertion-tutorial/">Building a Binary Search Tree &#8211; Insertion Tutorial</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="Building a Binary Search Tree - Insertion Tutorial" width="1380" height="776" src="https://www.youtube.com/embed/iuuUaa4CxoU?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">In this hands-on video we build a binary search tree by inserting numbers one by one: 73, 98, 12, 45, 67, 10, 43, 11, 99, and 32. Watch exactly how each node finds its place following BST rules with no rearranging allowed.</p>



<p class="wp-block-paragraph">We discuss why the tree becomes lopsided, calculate its height, and verify the in-order traversal is sorted. Great practice for anyone learning binary search trees.</p>



<p class="wp-block-paragraph">Next videos will cover searching and deleting nodes.</p>



<p class="wp-block-paragraph">If you&#8217;re studying data structures, build along with me!</p>



<p class="wp-block-paragraph">00:00 Introduction to Building a Binary Search Tree<br>00:14 Plan for Inserting Numbers<br>00:30 First Node Becomes Root<br>02:26 Begin inserting from data set<br>12:29 Final insertion from data set<br>13:26 Final Tree Overview<br>13:29 Tree is Lopsided<br>14:00 Drawing Depths and Levels<br>14:50 Calculating Tree Height<br>15:08 Verifying Sorted Order<br>16:00 Confirming BST Properties<br>16:48 Time Complexity and Height<br>18:59 No Self-Balancing<br>19:07 End of Video and Thanks</p>



<p class="wp-block-paragraph">=-=-=-=-=-=-=-=-=</p>



<p class="wp-block-paragraph">Thanks for watching!</p>



<p class="wp-block-paragraph">Find us on other social media here:</p>



<ul class="wp-block-list">
<li>https://www.NeuralLantern.com/social</li>



<li>Twitter / X: https://x.com/NeuralLantern</li>



<li>Rumble: https://rumble.com/c/c-3696939</li>



<li>BitChute: https://www.bitchute.com/channel/pg1Pvv5dN4Gt</li>



<li>Daily Motion: https://www.dailymotion.com/neurallantern</li>



<li>Minds: https://www.minds.com/neurallantern/</li>



<li>Odysee: https://odysee.com/@NeuralLantern:5</li>
</ul>



<p class="wp-block-paragraph">Please show your support!</p>



<ul class="wp-block-list">
<li>Buy me a coffee: https://ko-fi.com/neurallantern</li>



<li>Subscribe + Sharing on Social Media</li>



<li>Leave a comment or suggestion</li>



<li>Subscribe to the Blog: https://www.NeuralLantern.com</li>



<li>Watch the main &#8220;pinned&#8221; video of this channel for offers and extras</li>
</ul>



<p class="wp-block-paragraph">hey there let&#8217;s build a binary search tree together if you&#8217;ve seen my previous videos</p>



<p class="wp-block-paragraph">you understand now how to define a binary search tree meaning what are the rules</p>



<p class="wp-block-paragraph">that you have to like adhere to if you want your thing to be a binary search tree</p>



<p class="wp-block-paragraph">also terminology we&#8217;re in previous videos so in this video we&#8217;re just going to take a bunch of</p>



<p class="wp-block-paragraph">random numbers and we&#8217;re just going to start dropping them into our tree and see how the</p>



<p class="wp-block-paragraph">tree builds itself out we have to build our tree in a specific way if it&#8217;s going to be valid we&#8217;re</p>



<p class="wp-block-paragraph">uh valid we&#8217;re not going to rearrange our tree and try to make it super pretty this is going to be</p>



<p class="wp-block-paragraph">like a real binary search tree it might not be pretty but it&#8217;ll be real let&#8217;s see if i can find</p>



<p class="wp-block-paragraph">those numbers that i was going to set up okay so for this particular video i think i&#8217;m going to do</p>



<p class="wp-block-paragraph">two videos i want to build a binary search tree using the following numbers they&#8217;re not special</p>



<p class="wp-block-paragraph">not not perfect but what I mean to say when I say inserting these numbers is one by one we&#8217;ll look</p>



<p class="wp-block-paragraph">at each number and we&#8217;ll drop it in the tree and we&#8217;ll see where it falls according to binary</p>



<p class="wp-block-paragraph">search tree rules of insertion then we&#8217;ll just go to the next number and then the next and the next</p>



<p class="wp-block-paragraph">when we&#8217;re done we should have a tree and if you follow along at home and you use the right rules</p>



<p class="wp-block-paragraph">to build your tree then if we use the same sequence of numbers to build the tree we should</p>



<p class="wp-block-paragraph">they won&#8217;t suddenly be different they&#8217;re deterministic okay so the first thing that</p>



<p class="wp-block-paragraph">we should try to understand is uh when we want to insert a node the 73 node right here the first</p>



<p class="wp-block-paragraph">thing we should ask ourselves is do we actually have a root node for our binary search tree yet</p>



<p class="wp-block-paragraph">right now the answer is no this is just a blank tree there&#8217;s nothing in it which means that first</p>



<p class="wp-block-paragraph">number is going to be the root node you might be tempted to say no that&#8217;s a sucky root node let&#8217;s</p>



<p class="wp-block-paragraph">do something else well i don&#8217;t know i mean you just have to let the numbers fall where they&#8217;re</p>



<p class="wp-block-paragraph">going to fall just because a number seems to suck as a root node doesn&#8217;t mean it&#8217;s not going to be</p>



<p class="wp-block-paragraph">the root node if it&#8217;s the first thing you added it&#8217;s going to be the root node don&#8217;t try to change</p>



<p class="wp-block-paragraph">it or you&#8217;re going to mess you&#8217;re going to end up with topology that doesn&#8217;t match whatever system</p>



<p class="wp-block-paragraph">or person is trying to grade your work or evaluate your work so we have no root node that means the</p>



<p class="wp-block-paragraph">node of the entire tree we&#8217;re now done with 73 i&#8217;m going to duplicate this slide real fast</p>



<p class="wp-block-paragraph">and we&#8217;ll say now it&#8217;s time to try to add the 98 you know what i can i think i can do better than</p>



<p class="wp-block-paragraph">that arrow i can make a nice cute arrow with this program i&#8217;m going to do this can i like yeah</p>



<p class="wp-block-paragraph">hang on one more one more try nice okay so now let&#8217;s add the 98 node</p>



<p class="wp-block-paragraph">the first thing we have to ask is do we have a root node uh yes we can&#8217;t actually put the 98 there</p>



<p class="wp-block-paragraph">we now have to make a decision uh if you recall in my previous videos the lesser values go on the</p>



<p class="wp-block-paragraph">left and the greater values go on the right uh in in these trees which we&#8217;re not going to support</p>



<p class="wp-block-paragraph">duplicate values with if you wanted to support duplicate values you could do something like</p>



<p class="wp-block-paragraph">less than or equal to would be on the left and greater than on the right there&#8217;s a bunch of</p>



<p class="wp-block-paragraph">other ways you can do it but i&#8217;m just going to say no duplicate values in our trees so we look at the</p>



<p class="wp-block-paragraph">So we look at the 73 node and we ask, you know, is that where our 98 is going to go?</p>



<p class="wp-block-paragraph">It can&#8217;t go there because 73 exists.</p>



<p class="wp-block-paragraph">Now we have to ask the question, does 98 belong on the left side or the right side of the 73?</p>



<p class="wp-block-paragraph">Well, because 98 is greater than 73, it belongs on the right side, which means I&#8217;m going to duplicate this node over here.</p>



<p class="wp-block-paragraph">And I&#8217;m going to try to draw this well, which means basically splitting the difference in terms of the empty space.</p>



<p class="wp-block-paragraph">empty space and trying to keep the same rank as we go down one level of</p>



<p class="wp-block-paragraph">descendancy or like one generation down at a time.</p>



<p class="wp-block-paragraph">So the next time I go down a level,</p>



<p class="wp-block-paragraph">let&#8217;s say I do a left child in the future,</p>



<p class="wp-block-paragraph">it should be at the same level as the new node I just added.</p>



<p class="wp-block-paragraph">So I did a duplicate and I forgot to change the number.</p>



<p class="wp-block-paragraph">And then I&#8217;m going to do a line to connect the 73 and the 98.</p>



<p class="wp-block-paragraph">98 so now the 73 has a right child which is 98 the 98 has a parent which is 73 and we&#8217;re done</p>



<p class="wp-block-paragraph">adding the 98 we have to just move on to the next number okay so i&#8217;m going to move on to the 12</p>



<p class="wp-block-paragraph">again we look at the root node it&#8217;s occupied we cannot put the 12 right there on the 73 we have</p>



<p class="wp-block-paragraph">to make a decision do we go to the left or the right of the 73 12 is less than 73 so it belongs</p>



<p class="wp-block-paragraph">is to jump to the left side. Notice how the left side there&#8217;s no child on the left that means that&#8217;s</p>



<p class="wp-block-paragraph">where the new node is going to go so I&#8217;m just going to like select this duplicate it real fast</p>



<p class="wp-block-paragraph">maybe stick it on the same vertical coordinate and then also try to split the difference on</p>



<p class="wp-block-paragraph">the screen just to make it look pretty. I&#8217;m going to update that 98 so that it is now the 12.</p>



<p class="wp-block-paragraph">child 12 and then we&#8217;re done adding the 12. Okay, no problem so far. We then are ready to try to</p>



<p class="wp-block-paragraph">add the 45. Maybe I should squish this a little bit. Nope, that looks gross. No, it&#8217;s okay.</p>



<p class="wp-block-paragraph">We&#8217;ll do that. We&#8217;re going to add the 45. Again, we look at the root node. It already exists,</p>



<p class="wp-block-paragraph">so we can&#8217;t put the 45 there. Instead, we will just kind of decide does the 45 belong on the</p>



<p class="wp-block-paragraph">Okay, well, belongs on the left because it&#8217;s less than 73.</p>



<p class="wp-block-paragraph">So that means I&#8217;m now going to make a little decision.</p>



<p class="wp-block-paragraph">I&#8217;m going to jump down to the left.</p>



<p class="wp-block-paragraph">If you&#8217;re in some code, you&#8217;re following the left child pointer down.</p>



<p class="wp-block-paragraph">But notice how the left child pointer or the left child, it already exists.</p>



<p class="wp-block-paragraph">So we can&#8217;t actually put 45 right there.</p>



<p class="wp-block-paragraph">We have to make another decision.</p>



<p class="wp-block-paragraph">Does 45 belong on the left or the right of the 12?</p>



<p class="wp-block-paragraph">Well, it&#8217;s greater than 12.</p>



<p class="wp-block-paragraph">So it belongs on the right side of 12.</p>



<p class="wp-block-paragraph">So I&#8217;m going to highlight this and duplicate it.</p>



<p class="wp-block-paragraph">and duplicate it. I guess I&#8217;ll just do it that way. Then I&#8217;m going to update that number</p>



<p class="wp-block-paragraph">with 45 and then I&#8217;m going to connect the 12 and the 45 with the line. So now 45 is the right child</p>



<p class="wp-block-paragraph">of 12 and 12 is the parent of 45. It&#8217;s at this point that a lot of people start to get frustrated</p>



<p class="wp-block-paragraph">with me and they say, well, how come, how come the 12 is like all the way to the left and the 45 is</p>



<p class="wp-block-paragraph">45 is like didn&#8217;t become like you know a level higher because it kind of seems like it&#8217;s closer</p>



<p class="wp-block-paragraph">to 73 shouldn&#8217;t the 12 be hanging off the left child of the 45 no no no no don&#8217;t rearrange the</p>



<p class="wp-block-paragraph">nodes as you&#8217;re building the tree just let the numbers let the nodes fall wherever they&#8217;re</p>



<p class="wp-block-paragraph">supposed to go another tip is if you&#8217;re building a tree that has other data types as as the t types</p>



<p class="wp-block-paragraph">inside of the nodes as the template types inside of the nodes for example right now I&#8217;m just using</p>



<p class="wp-block-paragraph">type is int, at least in my mind, if you wanted to put dinosaur objects in the tree, all you&#8217;d</p>



<p class="wp-block-paragraph">have to do is make sure that your code for your dinosaur class for your dinosaur object</p>



<p class="wp-block-paragraph">had its inequality operators implemented, you know, less than, greater than, and then the tree</p>



<p class="wp-block-paragraph">would still know where to put all the objects. So you could make any kind of custom object you want</p>



<p class="wp-block-paragraph">and they would all fall in their correct places in the tree as long as the operators actually</p>



<p class="wp-block-paragraph">just as a side note. Okay, so now we&#8217;re ready to add the next item. So I&#8217;m going to erase this</p>



<p class="wp-block-paragraph">stuff here, and I&#8217;m going to move the arrow from the 45 to the 67. So now we&#8217;re going to try to</p>



<p class="wp-block-paragraph">add the 67. We look at the root node, it&#8217;s occupied. We should go to the left because 67</p>



<p class="wp-block-paragraph">is less than 73. We look at the 12, that&#8217;s occupied. So we go left or right. We should go</p>



<p class="wp-block-paragraph">to the right because 67 is greater than 12. So we look at the 45. Again, it&#8217;s occupied. There&#8217;s a</p>



<p class="wp-block-paragraph">a node there so we have to make another decision do we go to the left or to the right well 67 is</p>



<p class="wp-block-paragraph">greater than 45 so it goes on the right side so i&#8217;m going to duplicate this off to the right side</p>



<p class="wp-block-paragraph">and down a rank and we&#8217;ll call that the right child of 45. let me update the number here</p>



<p class="wp-block-paragraph">to 67 and i&#8217;ll connect that as the right child okay</p>



<p class="wp-block-paragraph">Any questions? I&#8217;m just kidding. That was rude. Just know that my heart is with you if you&#8217;re</p>



<p class="wp-block-paragraph">asking questions. Send me a comment in the comments. So now I&#8217;m going to move over to the 10 here.</p>



<p class="wp-block-paragraph">Again, we look at the 67. The 10 belongs on the left. So we kind of go to the left.</p>



<p class="wp-block-paragraph">We look at the 12. The 10 belongs on the left of the 12 because it&#8217;s less than 12.</p>



<p class="wp-block-paragraph">available slot that&#8217;s an available child pointer so I&#8217;m going to say the 10 is going to be the</p>



<p class="wp-block-paragraph">left child of the 12 node maybe I&#8217;ll stick it all the way over there let&#8217;s see is there anything</p>



<p class="wp-block-paragraph">less than 10 in there nope okay so we&#8217;ll be good we have enough space on the screen</p>



<p class="wp-block-paragraph">so change that to a 10 do the connecting line so the 10 is now the left child</p>



<p class="wp-block-paragraph">whoops the left child of the 12 node and now we&#8217;re ready to add the next node</p>



<p class="wp-block-paragraph">node. Okay. So now the 43 is the next one we want to add. One more time, we look at the 73 node,</p>



<p class="wp-block-paragraph">the root node is occupied. So we have to go to the left because 43 is less. So oops, that&#8217;s a line.</p>



<p class="wp-block-paragraph">So now we look at the 12 node is 43 greater than or less than the 12. It&#8217;s greater than so that</p>



<p class="wp-block-paragraph">means we go down to the right. But the 45 is there. So we have to make another decision. 43 is less</p>



<p class="wp-block-paragraph">43 is less than 45 so we go to the left that means this 43 is going to be the left child of 45.</p>



<p class="wp-block-paragraph">And again don&#8217;t try to make the tree pretty or better just let the nodes fall wherever they&#8217;re</p>



<p class="wp-block-paragraph">supposed to fall according to the rules of less than or greater than. So now we got the uh whoops</p>



<p class="wp-block-paragraph">I forgot to change that to a 43. The 43 right there and we are now ready to add another node</p>



<p class="wp-block-paragraph">So I&#8217;m going to like erase this stuff here and I want to move the arrow to the 11.</p>



<p class="wp-block-paragraph">Now once again, we&#8217;re looking for the root node.</p>



<p class="wp-block-paragraph">It&#8217;s already occupied.</p>



<p class="wp-block-paragraph">We say that 11 is supposed to go on the left because it&#8217;s less than.</p>



<p class="wp-block-paragraph">We look at the 12.</p>



<p class="wp-block-paragraph">It&#8217;s occupied.</p>



<p class="wp-block-paragraph">So we have to go to the left because 11 is less than 12.</p>



<p class="wp-block-paragraph">We go to the 10 and that&#8217;s also occupied.</p>



<p class="wp-block-paragraph">So we have to make another decision.</p>



<p class="wp-block-paragraph">Is 11 greater than or less than 10?</p>



<p class="wp-block-paragraph">It&#8217;s greater than.</p>



<p class="wp-block-paragraph">why the 11 goes on the right side of the 10. So I&#8217;m going to duplicate this over here. Notice how</p>



<p class="wp-block-paragraph">I&#8217;m trying to keep same ranked children or same depth children physically at the same level. It&#8217;s</p>



<p class="wp-block-paragraph">a lot easier to debug your diagrams if you do things this way. Notice also, as I mentioned in</p>



<p class="wp-block-paragraph">a previous video, that every left descendant of a node should be physically on the left side in my</p>



<p class="wp-block-paragraph">diagram and every right descendant should be physically on the right side. That just makes</p>



<p class="wp-block-paragraph">right side that just makes the diagram way easier to debug what do I mean by this look at 73&#8217;s left</p>



<p class="wp-block-paragraph">descendants its left subtree they&#8217;re all physically on the left look at the 12 node all of its right</p>



<p class="wp-block-paragraph">descendants or its right subtree they&#8217;re all physically on the right so you if you follow</p>



<p class="wp-block-paragraph">that rule it&#8217;s just way easier to debug I think I forgot to update that number from 43 to 11 so</p>



<p class="wp-block-paragraph">I&#8217;m going to do that now and we are ready to add the next number the 99 so I&#8217;m going to do this</p>



<p class="wp-block-paragraph">So I&#8217;m going to do this. We&#8217;re looking at 99.</p>



<p class="wp-block-paragraph">So first we start off by looking at the root node.</p>



<p class="wp-block-paragraph">It&#8217;s 73, occupied. 99 belongs on the right side.</p>



<p class="wp-block-paragraph">So now we bounce to the right side and we look at the 98.</p>



<p class="wp-block-paragraph">Whoops, whoops, whoops. We look at the 98.</p>



<p class="wp-block-paragraph">That&#8217;s occupied, so we make another decision.</p>



<p class="wp-block-paragraph">The 99 belongs on the right side of 98. That slot is available.</p>



<p class="wp-block-paragraph">So now we can say that the 99 node is supposed to be</p>



<p class="wp-block-paragraph">a right child of 99.</p>



<p class="wp-block-paragraph">Sorry, sorry.</p>



<p class="wp-block-paragraph">The 99 is the right child of the 98 node.</p>



<p class="wp-block-paragraph">I&#8217;m getting a little confused.</p>



<p class="wp-block-paragraph">Okay, so I&#8217;m gonna do a little connecting line there.</p>



<p class="wp-block-paragraph">And we&#8217;re ready to add the final value into our tree.</p>



<p class="wp-block-paragraph">So I&#8217;m gonna do, let&#8217;s see.</p>



<p class="wp-block-paragraph">Oh, oh, I accidentally erased the arrow.</p>



<p class="wp-block-paragraph">Oh, there it is.</p>



<p class="wp-block-paragraph">We can add the 32 next.</p>



<p class="wp-block-paragraph">add the 32 next and if we look at the 73 it&#8217;s occupied 32 belongs on the left so then we just</p>



<p class="wp-block-paragraph">kind of like follow down to the left here we look at the 12 32 belongs on the right of 12 so we</p>



<p class="wp-block-paragraph">follow down to the right 32 belongs on the left of 45 so we follow down to the left 32 belongs on</p>



<p class="wp-block-paragraph">the left of 43 and so we will make 32 the left child of the 43 node so I&#8217;m going to like select</p>



<p class="wp-block-paragraph">this real fast we go down a full rank and I&#8217;m going to try to split the difference between 12</p>



<p class="wp-block-paragraph">And I&#8217;m going to try to split the difference between 12 and 43 here just to make the diagram easier to debug.</p>



<p class="wp-block-paragraph">Okay, so then I&#8217;m going to do…</p>



<p class="wp-block-paragraph">It&#8217;s looking a little gross, but at least we&#8217;re finished.</p>



<p class="wp-block-paragraph">I have to update that 11 to be the 32.</p>



<p class="wp-block-paragraph">And now we&#8217;re done building our tree.</p>



<p class="wp-block-paragraph">Okay, so some things to point out real fast.</p>



<p class="wp-block-paragraph">Notice how the tree is lopsided.</p>



<p class="wp-block-paragraph">to look at various parts of the tree you might be frustrated why didn&#8217;t we put the 98 over there</p>



<p class="wp-block-paragraph">why didn&#8217;t we put the right just it&#8217;s fine as long as we follow the rules of building a binary search</p>



<p class="wp-block-paragraph">tree then this is the valid tree that we would have built of course later on you&#8217;ll learn techniques</p>



<p class="wp-block-paragraph">to make the tree a little bit better looking a little bit faster but right now we&#8217;re just building</p>



<p class="wp-block-paragraph">a tree with no optimizations no self balancing no anything like that this is our binary search tree</p>



<p class="wp-block-paragraph">tree if we were to take all of the uh you know all the numbers that we added and sort them</p>



<p class="wp-block-paragraph">then that should be the numbers we see from left to right this is another good argument for why we</p>



<p class="wp-block-paragraph">should draw the diagram in this way again like uh same depth nodes let me just draw the the depths</p>



<p class="wp-block-paragraph">real fast just to kind of illustrate the point a little bit same depth nodes should be on the same</p>



<p class="wp-block-paragraph">y coordinate or the same uh horizontal plane notice how 73 is the root node and then 12 with 98 have</p>



<p class="wp-block-paragraph">with 98 have a depth of 1 and then 10 45 and 99 have a depth of 2 and then 11 43 and 67 have a</p>



<p class="wp-block-paragraph">depth of 3 and then 32 has a depth of 4 so the deepest node we can find has a depth of 4 that&#8217;s</p>



<p class="wp-block-paragraph">the 32 node which means the height of the tree um height is 4 sorry 5 the height is always the</p>



<p class="wp-block-paragraph">deepest nodes depth plus 1 or the number of nodes you would have to touch as you found your way</p>



<p class="wp-block-paragraph">you found your way down to the deepest node for example if we wanted to get to that 32 we would</p>



<p class="wp-block-paragraph">touch one two three four five nodes so the height of this tree is five</p>



<p class="wp-block-paragraph">okay um let&#8217;s debug the order of our numbers because this is kind of easy to get wrong</p>



<p class="wp-block-paragraph">so from left to right we should see a sorted list so let me just uh do little markings here</p>



<p class="wp-block-paragraph">to indicate that i&#8217;m seeing increasing or at least non-decreasing numbers</p>



<p class="wp-block-paragraph">If our tree supported duplicates, then it would be non-decreasing.</p>



<p class="wp-block-paragraph">But since we don&#8217;t allow duplicates, it should be increasing or an ascending list.</p>



<p class="wp-block-paragraph">So I&#8217;m going to do the 10.</p>



<p class="wp-block-paragraph">And as we look towards the right, we should see increasing numbers.</p>



<p class="wp-block-paragraph">So we got the 10 there.</p>



<p class="wp-block-paragraph">And then we got the 11 there.</p>



<p class="wp-block-paragraph">And then we got the 12 there.</p>



<p class="wp-block-paragraph">32, 43, 45, 67.</p>



<p class="wp-block-paragraph">So far, so good.</p>



<p class="wp-block-paragraph">It&#8217;s all increasing.</p>



<p class="wp-block-paragraph">73 increases, 98 increases, and 99 increases.</p>



<p class="wp-block-paragraph">and 99 increases. So from left to right, it was basically a sorted list, which is what we want.</p>



<p class="wp-block-paragraph">So we&#8217;ve created a valid ordering for the tree. Now maybe just think about all the rules of a</p>



<p class="wp-block-paragraph">binary search tree to make sure we did that right too. So is this a graph? Yeah. Is it a connected</p>



<p class="wp-block-paragraph">graph? Yeah. Is it a tree? You know, no cycles in the graph? Yeah. Is it a rooted tree? Yeah. The 73</p>



<p class="wp-block-paragraph">root node is the common ancestor of all other nodes. We have one node that&#8217;s common to the</p>



<p class="wp-block-paragraph">in terms of ancestry um does any node have more than two children no none of the nodes have more</p>



<p class="wp-block-paragraph">than two children um they&#8217;ve all got zero or one or two children and then the numbers are in order</p>



<p class="wp-block-paragraph">and therefore this is a valid binary search tree so in other videos i&#8217;m going to talk about the</p>



<p class="wp-block-paragraph">time complexity and and like you know how fast it is to do certain operations or how imbalanced a</p>



<p class="wp-block-paragraph">just so you know this is not a perfect binary search tree you can tell because it&#8217;s a little</p>



<p class="wp-block-paragraph">lopsided um we calculated the height as five and let&#8217;s see where the heck is that calculator i</p>



<p class="wp-block-paragraph">thought i had a calculator on here oh no oh there it is if we calculated the height as five</p>



<p class="wp-block-paragraph">you could probably imagine and we&#8217;ll talk about searching in a future video like how do you search</p>



<p class="wp-block-paragraph">in a way that makes the tree super super fast well we certainly built the tree in a way that</p>



<p class="wp-block-paragraph">makes it super super fast we just have to get to searching later but if we</p>



<p class="wp-block-paragraph">search properly through a properly built binary search tree then at most it</p>



<p class="wp-block-paragraph">should only take us height number of examinations to find our way to any</p>



<p class="wp-block-paragraph">piece of data or to determine that a piece of data doesn&#8217;t exist for example</p>



<p class="wp-block-paragraph">I could say that the time complexity is O and we&#8217;ll do this in other videos of</p>



<p class="wp-block-paragraph">of h no matter what the tree looks like no matter how lopsided it is and what is h here five that</p>



<p class="wp-block-paragraph">just basically is saying in the worst case scenario i would have to touch five nodes to reach the very</p>



<p class="wp-block-paragraph">bottom of the tree and determine that a value didn&#8217;t exist or you know find a value at the very</p>



<p class="wp-block-paragraph">bottom of the tree so the worst case scenario touch five nodes so it&#8217;s o of h if we if we plug</p>



<p class="wp-block-paragraph">log base 2 so if we did log base 2 of n where n is the number of nodes uh oh how many nodes do we</p>



<p class="wp-block-paragraph">have shoot one two three four five six seven eight nine ten i think one two three four five six seven</p>



<p class="wp-block-paragraph">eight nine ten yeah log base two of ten notice how the number here says well it should take like</p>



<p class="wp-block-paragraph">somewhat close to three uh examinations at most four examinations but we just said it&#8217;s going to</p>



<p class="wp-block-paragraph">of a divergence between the real speed of the tree.</p>



<p class="wp-block-paragraph">It might take up to five examinations and log base two,</p>



<p class="wp-block-paragraph">which would be a perfect binary search tree.</p>



<p class="wp-block-paragraph">So the more lopsided a tree gets, the slower it actually becomes.</p>



<p class="wp-block-paragraph">And we&#8217;ll deal with that in future videos.</p>



<p class="wp-block-paragraph">We&#8217;ll learn how to like detect that and balance that and so forth.</p>



<p class="wp-block-paragraph">But so we&#8217;ve built a binary search tree.</p>



<p class="wp-block-paragraph">It&#8217;s definitely valid if not, you know, like super, super fast.</p>



<p class="wp-block-paragraph">And I think that&#8217;s the end of this video.</p>



<p class="wp-block-paragraph">Thank you so much for watching.</p>



<p class="wp-block-paragraph">I hope you learned a little bit of stuff and had a little bit of fun.</p>



<p class="wp-block-paragraph">In the next video, I think I&#8217;m just going to build another tree for you so we can get</p>



<p class="wp-block-paragraph">a second practice in.</p>



<p class="wp-block-paragraph">Okay, future videos also are going to include searching and deleting nodes and modifying</p>



<p class="wp-block-paragraph">existing nodes and just a whole bunch of other stuff.</p>



<p class="wp-block-paragraph">Then eventually we&#8217;ll do self-balancing trees.</p>



<p class="wp-block-paragraph">I&#8217;ll see you later.</p>



<p class="wp-block-paragraph">Hey everybody.</p>



<p class="wp-block-paragraph">Hey everybody!</p>



<p class="wp-block-paragraph">Thanks for watching this video again from the bottom of my heart.</p>



<p class="wp-block-paragraph">I really appreciate it.</p>



<p class="wp-block-paragraph">I do hope you did learn something and have some fun.</p>



<p class="wp-block-paragraph">If you could do me a please, a small little favor, could you please subscribe and follow</p>



<p class="wp-block-paragraph">this channel or these videos or whatever it is you do on the current social media website</p>



<p class="wp-block-paragraph">that you&#8217;re looking at right now.</p>



<p class="wp-block-paragraph">It would really mean the world to me and it&#8217;ll help make more videos and grow this community.</p>



<p class="wp-block-paragraph">So we&#8217;ll be able to do more videos, longer videos, better videos, or just I&#8217;ll be able</p>



<p class="wp-block-paragraph">I&#8217;ll be able to keep making videos in general.</p>



<p class="wp-block-paragraph">So please do me a kindness and subscribe.</p>



<p class="wp-block-paragraph">You know, sometimes I&#8217;m sleeping in the middle of the night</p>



<p class="wp-block-paragraph">and I just wake up because I know somebody subscribed or followed.</p>



<p class="wp-block-paragraph">It just wakes me up and I get filled with joy.</p>



<p class="wp-block-paragraph">That&#8217;s exactly what happens every single time.</p>



<p class="wp-block-paragraph">So you could do it as a nice favor to me</p>



<p class="wp-block-paragraph">or you could troll me if you want to just wake me up in the middle of the night.</p>



<p class="wp-block-paragraph">Just subscribe and then I&#8217;ll just wake up.</p>



<p class="wp-block-paragraph">I promise that&#8217;s what will happen.</p>



<p class="wp-block-paragraph">Also, if you look at the middle of the screen right now,</p>



<p class="wp-block-paragraph">right now you should see a QR code which you can scan in order to go to the website which I think</p>



<p class="wp-block-paragraph">is also named somewhere at the bottom of this video and it&#8217;ll take you to my main website where</p>



<p class="wp-block-paragraph">you can just kind of like see all the videos I published and the services and tutorials and</p>



<p class="wp-block-paragraph">things that I offer and all that good stuff and if you have a suggestion for clarifications or</p>



<p class="wp-block-paragraph">errata or just future videos that you want to see please leave a comment or if you just want to say</p>



<p class="wp-block-paragraph">what&#8217;s going on you know just send me a comment whatever i also wake up for those in the middle</p>



<p class="wp-block-paragraph">of the night i get i wake up in a cold sweat and i&#8217;m like it would really it really mean the world</p>



<p class="wp-block-paragraph">to me i would really appreciate it so again thank you so much for watching this video and um enjoy</p>



<p class="wp-block-paragraph">the cool music as as i fade into the darkness which is coming for us all</p>



<p class="wp-block-paragraph">Thank you.</p>



<p class="wp-block-paragraph">hey there let&#8217;s talk about uh</p>



<p class="wp-block-paragraph">hello there hello there let&#8217;s build a binary search tree by just inserting a bunch of numbers</p>



<p class="wp-block-paragraph">inserting a bunch of numbers and will follow the rules</p>
<p>The post <a href="https://www.NeuralLantern.com/building-a-binary-search-tree-insertion-tutorial/">Building a Binary Search Tree &#8211; Insertion Tutorial</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.NeuralLantern.com/building-a-binary-search-tree-insertion-tutorial/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
