<?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>computer science tutorial Archives - NeuralLantern.com</title>
	<atom:link href="https://www.NeuralLantern.com/tag/computer-science-tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.NeuralLantern.com/tag/computer-science-tutorial/</link>
	<description></description>
	<lastBuildDate>Tue, 16 Jun 2026 04:49:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.2</generator>

<image>
	<url>https://www.NeuralLantern.com/wp-content/uploads/2025/04/cropped-2025-04-04-Lantern-03-32x32.png</url>
	<title>computer science tutorial Archives - NeuralLantern.com</title>
	<link>https://www.NeuralLantern.com/tag/computer-science-tutorial/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>AVL Tree Rotations Practice: Balancing a Huge Linear Tree Step by Step</title>
		<link>https://www.NeuralLantern.com/avl-tree-rotations-practice-balancing-a-huge-linear-tree-step-by-step/</link>
					<comments>https://www.NeuralLantern.com/avl-tree-rotations-practice-balancing-a-huge-linear-tree-step-by-step/#respond</comments>
		
		<dc:creator><![CDATA[mike]]></dc:creator>
		<pubDate>Tue, 16 Jun 2026 04:49:15 +0000</pubDate>
				<category><![CDATA[AVL Trees]]></category>
		<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[AVL balance factor]]></category>
		<category><![CDATA[avl rotations]]></category>
		<category><![CDATA[AVL tree]]></category>
		<category><![CDATA[balanced binary tree]]></category>
		<category><![CDATA[binary search tree]]></category>
		<category><![CDATA[bst]]></category>
		<category><![CDATA[coding interview]]></category>
		<category><![CDATA[computer science tutorial]]></category>
		<category><![CDATA[data structures]]></category>
		<category><![CDATA[rotation examples]]></category>
		<category><![CDATA[self balancing tree]]></category>
		<category><![CDATA[tree rotations]]></category>
		<guid isPermaLink="false">https://www.NeuralLantern.com/?p=391</guid>

					<description><![CDATA[<p>Learn how to perform AVL tree rotations on a completely linear binary search tree. This step-by-step practice video shows multiple rotations, balance factor updates, and how to transform an unbalanced O(n) tree into a balanced O(log n) AVL tree.</p>
<p>The post <a href="https://www.NeuralLantern.com/avl-tree-rotations-practice-balancing-a-huge-linear-tree-step-by-step/">AVL Tree Rotations Practice: Balancing a Huge Linear Tree 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="AVL Tree Rotations Practice: Balancing a Huge Linear Tree Step by Step" width="1380" height="776" src="https://www.youtube.com/embed/mykKNhayTJM?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 AVL tree tutorial, we take a massive unbalanced linear binary search tree and perform multiple rotations to turn it into a properly balanced AVL tree. Watch as we identify imbalance, label X Y Z nodes, determine A B C, handle outstanding children, and reattach subtrees step by step.</p>



<p class="wp-block-paragraph">Perfect for computer science students learning data structures, self-balancing trees, and AVL rotations. We go through several rotations on the same tree to show the full process from start to finish.</p>



<p class="wp-block-paragraph">If you&#8217;ve seen the basics, this is the practice video you&#8217;ve been looking for. Timestamps and clear diagrams included.</p>



<p class="wp-block-paragraph">Like and subscribe for more data structures content!</p>



<p class="wp-block-paragraph">00:00 Introduction to AVL Rotations Practice<br>00:22 Previous Videos Overview<br>00:56 Understanding the Linear Tree Problem<br>01:24 Why Balance This Tree<br>02:20 Computing Balance Factors<br>03:16 First Rotation Setup XYZ<br>04:04 In-Order ABC Pattern<br>05:50 Reattaching Subtree<br>07:17 Recompute Balance Factors<br>08:06 Second Rotation Setup<br>09:20 XYZ and ABC for Second Rotation<br>10:08 Drawing Output Pattern<br>11:40 Placing Outstanding Children<br>13:32 Third Rotation Setup<br>14:28 XYZ for Third Rotation<br>15:02 Output Pattern and Children<br>18:28 Recompute Balance Factors<br>19:28 Fourth Rotation Setup<br>20:04 XYZ for Final Rotation<br>20:32 Handling All Outstanding Children<br>23:20 Reattaching Final Subtree<br>24:50 Last Rotation Setup<br>25:48 XYZ and ABC Final<br>26:38 Output Pattern and Children Placement<br>30:16 Final Balance Factors Check<br>30:52 Valid AVL Tree Achieved<br>31:07 Conclusion 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">Hello there! Let&#8217;s practice AVL rotations with a big ugly gross linear tree that for some reason hasn&#8217;t been rotating up to this point.</p>



<p class="wp-block-paragraph">But we&#8217;re going to rotate it all at once to make it nice and balanced per the rules of AVL trees, just for practice.</p>



<p class="wp-block-paragraph">Okay, so first off, you should have hopefully seen my previous videos.</p>



<p class="wp-block-paragraph">search trees how to define them how to build them search through them add remove stuff all that</p>



<p class="wp-block-paragraph">stuff and then we talked about abl trees which are really just self-balancing binary search</p>



<p class="wp-block-paragraph">trees with some extra special rules on top we talked about the types of rotations how to do</p>



<p class="wp-block-paragraph">the rotations when to rotate when to how to detect whether a tree is actually a valid abl tree and</p>



<p class="wp-block-paragraph">all that stuff so if you don&#8217;t know what i&#8217;m talking about see my previous videos otherwise</p>



<p class="wp-block-paragraph">we&#8217;re just going to practice on this one tree right now we&#8217;re just going to do a practice run</p>



<p class="wp-block-paragraph">run. Okay so you would never I mean you would hopefully never see an AVL tree</p>



<p class="wp-block-paragraph">that looks like this. This is way too imbalanced for an AVL tree. An AVL tree</p>



<p class="wp-block-paragraph">would have started rebalancing itself a long time ago but let&#8217;s just pretend for</p>



<p class="wp-block-paragraph">the sake of argument that you disabled the balancing feature of your AVL tree.</p>



<p class="wp-block-paragraph">You maybe like have a boolean inside of your class that you&#8217;ve written in your</p>



<p class="wp-block-paragraph">program called am I behaving like an AVL tree true or false and you set it to</p>



<p class="wp-block-paragraph">for a while then you started throwing nodes at the tree after you ended up with this giant linear</p>



<p class="wp-block-paragraph">tree then we&#8217;re going to suddenly turn on the avlness bool and start rotating this tree sucks</p>



<p class="wp-block-paragraph">this is a valid binary search tree but like if you notice it follows all the rules of a binary</p>



<p class="wp-block-paragraph">search tree and the data is in order but this is definitely not a valid avl tree the time</p>



<p class="wp-block-paragraph">complexity of searching through this tree would be o of h and since o of h is actually the number</p>



<p class="wp-block-paragraph">h is actually the number of nodes in the entire tree the time complexity of</p>



<p class="wp-block-paragraph">searching through this particular tree is o of n so this is a linear tree it&#8217;s</p>



<p class="wp-block-paragraph">no faster to search through than a linked list at least in terms of</p>



<p class="wp-block-paragraph">scalability so this is bad we need to fix this so now let&#8217;s turn on the AVL</p>



<p class="wp-block-paragraph">ness we&#8217;ll say okay now you&#8217;re no longer pretending to be a regular binary search</p>



<p class="wp-block-paragraph">tree you&#8217;re an AVL tree let&#8217;s do some rotations the first thing we should do</p>



<p class="wp-block-paragraph">do if you&#8217;re presented with a tree like this all at once is just compute the balance factors for</p>



<p class="wp-block-paragraph">every single node. So I&#8217;m going to say the 55 is a leaf it has a balance factor of 0, the 42 has a</p>



<p class="wp-block-paragraph">balance factor of 1, and really the balance factors just increase by 1 for every level up we go. So</p>



<p class="wp-block-paragraph">the balance factor of the 15 node is horrible, it&#8217;s really really really bad. Now that we&#8217;ve done</p>



<p class="wp-block-paragraph">this we could rotate anywhere we wanted to. I mean it&#8217;s valid to rotate starting with the 34 or the</p>



<p class="wp-block-paragraph">or the 27 or 22 or 15 you wouldn&#8217;t want to rotate the 42 because that&#8217;s not</p>



<p class="wp-block-paragraph">imbalanced enough for an AVL tree but really the smartest thing to do is</p>



<p class="wp-block-paragraph">rotate as low as possible because when you rotate stuff that&#8217;s lower it tends</p>



<p class="wp-block-paragraph">to fix stuff that&#8217;s higher so then you&#8217;ll end up doing less work and</p>



<p class="wp-block-paragraph">probably end up with a tree that matches what someone else expected okay so we&#8217;re</p>



<p class="wp-block-paragraph">going to rotate as low as possible that means I&#8217;m going to find the lowest node</p>



<p class="wp-block-paragraph">and I&#8217;m going to say it&#8217;s the 34 node and I&#8217;ll label that as Z.</p>



<p class="wp-block-paragraph">That&#8217;s bad. Let me try again.</p>



<p class="wp-block-paragraph">34 is Z.</p>



<p class="wp-block-paragraph">Okay, then we find the A child of the Z node</p>



<p class="wp-block-paragraph">and we have to find the child that has a taller subtree,</p>



<p class="wp-block-paragraph">but there&#8217;s only one choice.</p>



<p class="wp-block-paragraph">We can only go to the right.</p>



<p class="wp-block-paragraph">There&#8217;s nothing on the left.</p>



<p class="wp-block-paragraph">So that means Y is the 42 node.</p>



<p class="wp-block-paragraph">Same thing for the X node.</p>



<p class="wp-block-paragraph">We&#8217;re labeling for X and we have to find a child of Y.</p>



<p class="wp-block-paragraph">We have to look at the taller subtree,</p>



<p class="wp-block-paragraph">We have to look at the taller subtree, but there is no other choice.</p>



<p class="wp-block-paragraph">We can only go down and to the right.</p>



<p class="wp-block-paragraph">So now we know our XYZ.</p>



<p class="wp-block-paragraph">I&#8217;m just going to place these labels up here at the top.</p>



<p class="wp-block-paragraph">I&#8217;m going to say X is 55, Y is 42, and Z is 34.</p>



<p class="wp-block-paragraph">And maybe I&#8217;m going to change that text color real fast.</p>



<p class="wp-block-paragraph">Then we want to produce an in-order representation of XYZ.</p>



<p class="wp-block-paragraph">This step, I think it helps people with diagrams, but it also helps you a lot when it comes time to code.</p>



<p class="wp-block-paragraph">when it comes time to code,</p>



<p class="wp-block-paragraph">because coding for these rotations is way easier</p>



<p class="wp-block-paragraph">than diagramming these rotations.</p>



<p class="wp-block-paragraph">You pretty much just have to come up with three new pointers,</p>



<p class="wp-block-paragraph">A and B and C,</p>



<p class="wp-block-paragraph">and all they are is the ordered version of XYZ.</p>



<p class="wp-block-paragraph">So, you know, which node belongs on the very left,</p>



<p class="wp-block-paragraph">that&#8217;s gonna be 34,</p>



<p class="wp-block-paragraph">which node would belong in the middle,</p>



<p class="wp-block-paragraph">that&#8217;s gonna be 42,</p>



<p class="wp-block-paragraph">which node would belong on the right side,</p>



<p class="wp-block-paragraph">that&#8217;s gonna be 55.</p>



<p class="wp-block-paragraph">And so now we&#8217;re ready to come up with our output pattern.</p>



<p class="wp-block-paragraph">So I&#8217;m just gonna take one of these nodes</p>



<p class="wp-block-paragraph">So I&#8217;m just going to take one of these nodes and copy it.</p>



<p class="wp-block-paragraph">Maybe get rid of that little stem there.</p>



<p class="wp-block-paragraph">And then I&#8217;m going to just, you know, copy paste this a couple of times as quickly as I can.</p>



<p class="wp-block-paragraph">It doesn&#8217;t need to be perfect.</p>



<p class="wp-block-paragraph">But if it&#8217;s not, they&#8217;ll laugh at you.</p>



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



<p class="wp-block-paragraph">So we&#8217;ll do this.</p>



<p class="wp-block-paragraph">And we&#8217;ll draw some connecting lines.</p>



<p class="wp-block-paragraph">So we&#8217;ve got like three nodes here.</p>



<p class="wp-block-paragraph">A perfect little tri-node subtree because we picked X and Y and Z.</p>



<p class="wp-block-paragraph">because we picked X and Y and Z and that became A and B and C.</p>



<p class="wp-block-paragraph">Can&#8217;t get that line right, I&#8217;m going to give up.</p>



<p class="wp-block-paragraph">So then we, I&#8217;m going to fix the labels here. So what is A belonging on the left?</p>



<p class="wp-block-paragraph">That&#8217;s 34. What is B which belongs in the middle? That&#8217;s 42.</p>



<p class="wp-block-paragraph">What is C which belongs on the right? That&#8217;s 55. So now we have</p>



<p class="wp-block-paragraph">a perfectly balanced trinode subtree. Notice how this is a valid binary search tree.</p>



<p class="wp-block-paragraph">If the numbers were in a different order, this wouldn&#8217;t be</p>



<p class="wp-block-paragraph">a valid binary search tree and you&#8217;d have to try again with your ordering and also this has to be</p>



<p class="wp-block-paragraph">a perfectly balanced trinode subtree otherwise this probably wouldn&#8217;t actually help if we if</p>



<p class="wp-block-paragraph">we did a different output pattern it wouldn&#8217;t help the tree so then the next thing we need to do is</p>



<p class="wp-block-paragraph">just double check that we don&#8217;t have any nodes that are unaccounted for from the input pattern</p>



<p class="wp-block-paragraph">the xyz nodes so if we look at the uh the 34 node let&#8217;s look at z first i guess we&#8217;ll look at the 34</p>



<p class="wp-block-paragraph">had 42 as a child but 42 is already handled so that&#8217;s actually okay then we look at the y node</p>



<p class="wp-block-paragraph">that&#8217;s 42 it had 34 and 55 as children the 34 was handled uh here and the 55 is handled here so we</p>



<p class="wp-block-paragraph">actually are fine we don&#8217;t need to worry about that now we&#8217;ll look at the x node the x node had</p>



<p class="wp-block-paragraph">no children so we&#8217;re pretty much done again like i said in previous videos there could have been up</p>



<p class="wp-block-paragraph">You know, each of these XYZ nodes could have had its own children.</p>



<p class="wp-block-paragraph">Notice how 34 could have had one, 42 could have had one, 55 could have had two.</p>



<p class="wp-block-paragraph">So there would be four outstanding children.</p>



<p class="wp-block-paragraph">So we&#8217;re actually done at this point with the outstanding children.</p>



<p class="wp-block-paragraph">There are none.</p>



<p class="wp-block-paragraph">So I&#8217;m ready to reattach this tree, I guess the rotated subtree, into the regular tree.</p>



<p class="wp-block-paragraph">So these three nodes can just go away from our diagram.</p>



<p class="wp-block-paragraph">In code, you&#8217;re not actually removing these nodes.</p>



<p class="wp-block-paragraph">You&#8217;re just sort of, you know, reattaching pointers.</p>



<p class="wp-block-paragraph">reattaching pointers but I&#8217;m going to redraw this in a way that looks kind of nice and I&#8217;ll just</p>



<p class="wp-block-paragraph">maybe redo this line real fast so I&#8217;m going to do a blue line here okay now we have to recompute the</p>



<p class="wp-block-paragraph">balance factors so I&#8217;m going to say that the 34 is a leaf it&#8217;s got balance factor of zero same for</p>



<p class="wp-block-paragraph">perfectly balanced and then we have to work our way up until we reach the root node. So</p>



<p class="wp-block-paragraph">the 27 node, it&#8217;s got two nodes hanging off the right side and nothing on the left.</p>



<p class="wp-block-paragraph">So its new balance factor is two. So it actually improved a little bit.</p>



<p class="wp-block-paragraph">The 22 node, one, two, three, it&#8217;s got three nodes hanging off the right side and nothing</p>



<p class="wp-block-paragraph">on the left. So it improved a little bit to three. And I&#8217;m guessing that the 15 also improved to four.</p>



<p class="wp-block-paragraph">You can see the height on the left subtree of 15 is one, two, three, four, nothing on the left,</p>



<p class="wp-block-paragraph">So we&#8217;re done with this particular rotation.</p>



<p class="wp-block-paragraph">But because we see a node that has a balance factor of two or worse,</p>



<p class="wp-block-paragraph">we&#8217;re not actually done rotating.</p>



<p class="wp-block-paragraph">This is still an invalid AVL tree.</p>



<p class="wp-block-paragraph">And under the hood, we would continually just, you know, rotate up and up and up the tree</p>



<p class="wp-block-paragraph">until everything looked like it was fixed.</p>



<p class="wp-block-paragraph">So again, the first node that&#8217;s out of whack, or I guess the lowest node that&#8217;s out of whack,</p>



<p class="wp-block-paragraph">we&#8217;ll call that our Z node.</p>



<p class="wp-block-paragraph">So we&#8217;re going to put a Z here.</p>



<p class="wp-block-paragraph">piece of text and then we have to find a child of Z with the tallest subtree so there&#8217;s no child on</p>



<p class="wp-block-paragraph">the left which means we have to go to the right to find our Y node okay then we have to go find X</p>



<p class="wp-block-paragraph">through a child of Y and we have to find the child with the taller subtree actually the left child</p>



<p class="wp-block-paragraph">and the right child have the same height of their trees of their subtrees so it doesn&#8217;t actually</p>



<p class="wp-block-paragraph">know for fun let&#8217;s just go to the left because it&#8217;ll probably be harder we&#8217;ll say that the x</p>



<p class="wp-block-paragraph">node is 34. be consistent if you always whenever you see like sub trees that are equal height</p>



<p class="wp-block-paragraph">i don&#8217;t know maybe try to be consistent going left or right but in this case it doesn&#8217;t really matter</p>



<p class="wp-block-paragraph">so we have xyz i&#8217;m going to type them up again right here we&#8217;re going to say x equals</p>



<p class="wp-block-paragraph">Let me just double check that 34 42 27 and then we&#8217;ll produce ABC, which are the in order</p>



<p class="wp-block-paragraph">representations of XYZ.</p>



<p class="wp-block-paragraph">Again, imagine you&#8217;re using pointers if you&#8217;re doing this in code.</p>



<p class="wp-block-paragraph">So we have like a is equal to the least value, the one that would belong on the left.</p>



<p class="wp-block-paragraph">That&#8217;s the 27 B should be 34 and C should be 42.</p>



<p class="wp-block-paragraph">And then, you know, just visually check.</p>



<p class="wp-block-paragraph">way so that all the nodes have their own space. The one that&#8217;s furthest on the left is Z and that</p>



<p class="wp-block-paragraph">ends up being A. The one in the middle is X, that&#8217;s B, and the one on the right is C, that&#8217;s 42, Y.</p>



<p class="wp-block-paragraph">Right, yeah. Okay, so now that we&#8217;ve selected our ABC we can start drawing the output pattern. So</p>



<p class="wp-block-paragraph">I&#8217;m going to like make a little copy of this and I&#8217;m just going to very quickly try to draw</p>



<p class="wp-block-paragraph">balanced maybe a little bit lower they&#8217;ll laugh at you um they won&#8217;t they will i&#8217;m just kidding</p>



<p class="wp-block-paragraph">let me finish this line</p>



<p class="wp-block-paragraph">all right fix the numbers real fast uh so a is supposed to be on the left so that&#8217;s 27 that&#8217;s</p>



<p class="wp-block-paragraph">already good uh b is 34 c is 42 so now we have to just worry about the unaccounted for children of</p>



<p class="wp-block-paragraph">unaccounted for children of ABC or XYZ. So first I&#8217;m going to look at X. Whoops.</p>



<p class="wp-block-paragraph">We look at X, it&#8217;s 34. It had no children of its own, so we don&#8217;t even have to worry about any of</p>



<p class="wp-block-paragraph">its children. So we&#8217;re done. We look at Y, Y had two children. It had 34, but 34 was already handled</p>



<p class="wp-block-paragraph">up here. And it had a right child of 55. Oh, so we have a child that is unaccounted for now. So I&#8217;m</p>



<p class="wp-block-paragraph">duplicate it over here. We got to put it somewhere. I don&#8217;t know where just yet.</p>



<p class="wp-block-paragraph">You can probably figure it out, but I&#8217;m just going to put it over there. Now we&#8217;re done looking for the Y.</p>



<p class="wp-block-paragraph">And then next we&#8217;ll look at the Z node.</p>



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



<p class="wp-block-paragraph">the Z node is 27. It had a 42 as a right child, but 42 was already handled in the output pattern.</p>



<p class="wp-block-paragraph">So we&#8217;re done looking for outstanding children.</p>



<p class="wp-block-paragraph">So the next thing I&#8217;m going to do is figure out where the heck does that 55 go?</p>



<p class="wp-block-paragraph">does that 55 go? Remember, we&#8217;re trying to make valid binary search trees, which means there&#8217;s</p>



<p class="wp-block-paragraph">only one place where this 55 node could actually go. If you stuck it on the left side, a greater</p>



<p class="wp-block-paragraph">value on the left of 27, that&#8217;s invalid. That wouldn&#8217;t work. 55 is greater than 34, so it can&#8217;t</p>



<p class="wp-block-paragraph">go on the left. It&#8217;s greater than 42. So actually 55 belongs all the way on the right side, because</p>



<p class="wp-block-paragraph">again, that&#8217;s the only place it would actually work to allow us to still have a valid binary</p>



<p class="wp-block-paragraph">search tree when we were done placing it so double check the subtree that you have written down after</p>



<p class="wp-block-paragraph">you&#8217;re done doing all this stuff and make sure that the whole entire tree is a valid binary search</p>



<p class="wp-block-paragraph">tree if not you probably have to try again okay so i&#8217;m going to duplicate this slide right here</p>



<p class="wp-block-paragraph">and we&#8217;re going to say that we&#8217;ve got four nodes ready to be inserted in place of these four nodes</p>



<p class="wp-block-paragraph">over here one two three four so i&#8217;m going to just select all four of these nodes and just delete them</p>



<p class="wp-block-paragraph">and reinsert the rotated, you know, the rotated nodes, which are the same nodes, but they&#8217;re just,</p>



<p class="wp-block-paragraph">you know, they&#8217;re drawn differently with, you know, different connections. And then I&#8217;m going</p>



<p class="wp-block-paragraph">to fix this connection over here. So that&#8217;s 34 is now the right child of 22. Then I have to do</p>



<p class="wp-block-paragraph">the balance factors for all of the nodes that we rearranged. So the leaves are easy. As usual,</p>



<p class="wp-block-paragraph">This 42 has a balance factor of 1, and this 34 has a balance factor of also 1.</p>



<p class="wp-block-paragraph">It&#8217;s not perfect, but it&#8217;s okay.</p>



<p class="wp-block-paragraph">Then we work our way up the tree until we find the root node.</p>



<p class="wp-block-paragraph">So now we&#8217;re going to recompute the balance factor for the 22.</p>



<p class="wp-block-paragraph">Actually, it doesn&#8217;t improve.</p>



<p class="wp-block-paragraph">If you notice, the right subtree has a height of 1, 2, 3.</p>



<p class="wp-block-paragraph">There is no left subtree, so the balance factor is 3.</p>



<p class="wp-block-paragraph">Same thing for this 15 node.</p>



<p class="wp-block-paragraph">So we made a little progress.</p>



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



<p class="wp-block-paragraph">We have to keep going.</p>



<p class="wp-block-paragraph">So, you know, once again, I&#8217;m going to select the lowest node that&#8217;s out of whack.</p>



<p class="wp-block-paragraph">Or I guess as I work my way up the subtree, I can see that three node is still out of whack.</p>



<p class="wp-block-paragraph">So I&#8217;m going to call that Z.</p>



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



<p class="wp-block-paragraph">Somebody remind me to do what types of rotations to talk about the rotation types.</p>



<p class="wp-block-paragraph">Somebody send me an email or a comment.</p>



<p class="wp-block-paragraph">I&#8217;m going to do it at the end of this video, but send me a comment anyway.</p>



<p class="wp-block-paragraph">So the Z node is the 22 node.</p>



<p class="wp-block-paragraph">22 node to find the y node we have to take a child of z with the tallest subtree but that&#8217;s obviously going to be 34</p>



<p class="wp-block-paragraph">There&#8217;s no other choice</p>



<p class="wp-block-paragraph">And now we actually do have an interesting choice to find the x node</p>



<p class="wp-block-paragraph">It has to be a child of y, but it&#8217;s got to be the child with the tallest subtree</p>



<p class="wp-block-paragraph">So for the first time we can kind of see</p>



<p class="wp-block-paragraph">That we you know, we might have wanted to put x on the left or right, but it has to be on the right</p>



<p class="wp-block-paragraph">We&#8217;re not allowed to put it on on the left at least for this method</p>



<p class="wp-block-paragraph">So there we go. We have our XYZ. I&#8217;m going to go ahead and do X is equal to 42, and Y is equal to 34, and Z is equal to 22, and then A, B, and C are going to be the in-order representations.</p>



<p class="wp-block-paragraph">the middle 42 goes on the right so now i&#8217;m ready to draw my output pattern so i&#8217;m going to like</p>



<p class="wp-block-paragraph">select this real fast duplicate it up here make some copies making copies anyone no okay just</p>



<p class="wp-block-paragraph">just wondering okay i&#8217;m going to do this do some connecting lines</p>



<p class="wp-block-paragraph">So A is supposed to be on the left, that&#8217;s 22, and then B is going to be 34, and C is</p>



<p class="wp-block-paragraph">going to be on the right, that&#8217;s going to be 42.</p>



<p class="wp-block-paragraph">So we have a perfectly balanced trinode subtree.</p>



<p class="wp-block-paragraph">Now we&#8217;ve got to double check for outstanding children.</p>



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



<p class="wp-block-paragraph">Oh my god.</p>



<p class="wp-block-paragraph">Not as skilled as I think I am.</p>



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



<p class="wp-block-paragraph">which is already handled over here so we&#8217;re fine that way then we&#8217;ll look at the y node the y node</p>



<p class="wp-block-paragraph">was 34 it had a left child of 27 that is not accounted for in the output pattern so i&#8217;m going</p>



<p class="wp-block-paragraph">to grab it and then also you know when you&#8217;re grabbing these unaccounted for children double</p>



<p class="wp-block-paragraph">check that they might also have children of their own if they do we have to take them with the node</p>



<p class="wp-block-paragraph">that we&#8217;re moving so if 27 had any children we would not be you know removing or rearranging</p>



<p class="wp-block-paragraph">children and just kind of you know let them stay in their position underneath 27. You know we would</p>



<p class="wp-block-paragraph">not rearrange pointers that are further down but in this case what have I done in this case 27</p>



<p class="wp-block-paragraph">doesn&#8217;t have any children I&#8217;ll have to do a copy that&#8217;s why make a copy put it somewhere so now</p>



<p class="wp-block-paragraph">we&#8217;re done with the 27 on the right side of 34 it had a child of 42 but that&#8217;s already handled</p>



<p class="wp-block-paragraph">42 and then I&#8217;ll just put like an arrow here. Now we&#8217;re ready to look at the X nodes children.</p>



<p class="wp-block-paragraph">So the X is 42. It had a right child of 55 which is also not accounted for in the output pattern.</p>



<p class="wp-block-paragraph">So I&#8217;m going to just move that over here.</p>



<p class="wp-block-paragraph">Okay now we have to place these children in their appropriate positions.</p>



<p class="wp-block-paragraph">So the 55 if you think about it there&#8217;s only one position that the 55 could ever go</p>



<p class="wp-block-paragraph">go to produce a valid binary search tree so it can&#8217;t go there it&#8217;s got to go all the way on the</p>



<p class="wp-block-paragraph">right side so that&#8217;s where we&#8217;ll put it same thing for the 27 there&#8217;s only one place it could go it</p>



<p class="wp-block-paragraph">can&#8217;t go here because it&#8217;s less than 34 so it can&#8217;t be on the right side of 34 it&#8217;s going to</p>



<p class="wp-block-paragraph">be on the left side of 34 and if you look at where is it going to go with respect to 22 it can&#8217;t go</p>



<p class="wp-block-paragraph">on the left it has to go on the right because again we need a valid binary search tree</p>



<p class="wp-block-paragraph">So I&#8217;m just going to connect this line right here.</p>



<p class="wp-block-paragraph">And now we&#8217;re done making our little output tree, subtree.</p>



<p class="wp-block-paragraph">So how many nodes did we have in the input tree?</p>



<p class="wp-block-paragraph">It was 22, 34, 42, and 55, so like five nodes.</p>



<p class="wp-block-paragraph">And if you look at the output pattern here, there&#8217;s also five nodes.</p>



<p class="wp-block-paragraph">So we&#8217;re pretty much ready to just kind of remove all of these nodes</p>



<p class="wp-block-paragraph">all the way up to that 15.</p>



<p class="wp-block-paragraph">and make it the right child of 15. So I&#8217;m going to select all of this stuff, make it the right child</p>



<p class="wp-block-paragraph">of 15, and then I guess I&#8217;ll just redo that line real fast. So this is a nicely formatted diagram.</p>



<p class="wp-block-paragraph">So we&#8217;ll do what&#8217;s going on with my computer. Okay, sometimes it lags. I&#8217;m gonna, well,</p>



<p class="wp-block-paragraph">balance factors now so I&#8217;m going to do balance factors for the leaves pretty easy the 22 and the</p>



<p class="wp-block-paragraph">42 have a balance factor of one again if this is confusing see my previous videos we practiced a</p>



<p class="wp-block-paragraph">lot of that the balance factor for the 34 is going to be a zero remember it&#8217;s about the height of the</p>



<p class="wp-block-paragraph">left subtree versus the right subtree which there&#8217;s no difference actually they both have a height of</p>



<p class="wp-block-paragraph">two it&#8217;s you know just just because there&#8217;s a little diagonal bounce there on one side doesn&#8217;t</p>



<p class="wp-block-paragraph">awesome. Not perfect, but it&#8217;s pretty good. We look at the 15. What&#8217;s the new balance factor of</p>



<p class="wp-block-paragraph">the 15? It&#8217;s actually three now because the height of its right subtree is three and the height of</p>



<p class="wp-block-paragraph">its left subtree is zero. So its balance factor improved to three. So we are making, you know,</p>



<p class="wp-block-paragraph">a little bit of progress. Now we know that the only node that&#8217;s out of whack in the whole tree</p>



<p class="wp-block-paragraph">is the 15. So we&#8217;re just going to call that our Z node for another rotation. So I&#8217;m going to put Z</p>



<p class="wp-block-paragraph">of z which would be y and there&#8217;s no other choice and then once again we have to find a child of y</p>



<p class="wp-block-paragraph">to find x and we have to take the child that has the taller subtree but both of these subtrees</p>



<p class="wp-block-paragraph">are equal so i&#8217;m just going to go to the right for fun i don&#8217;t know i&#8217;m going to do x over here</p>



<p class="wp-block-paragraph">on the on the right side well hang on have i been doing this the easy way oh yeah let&#8217;s let&#8217;s go to</p>



<p class="wp-block-paragraph">Okay, so now we have XYZ. I don&#8217;t know why I say these things. We&#8217;ll do XYZ. X equals 22. Y is equal to 34. I say them for fun. Z is equal to 15. And then we&#8217;re going to do A and B and C. So A is going to be the least value. So that&#8217;s 15. B is going to be 22. C is going to be 34.</p>



<p class="wp-block-paragraph">tree so i&#8217;m going to copy this over here a couple more times this tree is probably going to be huge</p>



<p class="wp-block-paragraph">i&#8217;m probably gonna have to rearrange this a few times just do this over here make another copy</p>



<p class="wp-block-paragraph">over here there&#8217;s a lot of nodes that are going to be unaccounted for here um i think this was</p>



<p class="wp-block-paragraph">the example where we ended up just replacing the entire tree let&#8217;s see all right i guess that&#8217;s</p>



<p class="wp-block-paragraph">And then I&#8217;m going to update the numbers. So A is 15, and B is 22, and C is 34.</p>



<p class="wp-block-paragraph">So now one by one we have to look for any outstanding children of the nodes in the output pattern.</p>



<p class="wp-block-paragraph">So we look at, let&#8217;s say, the Z first.</p>



<p class="wp-block-paragraph">The Z had a right child of 34, but that&#8217;s already taken care of in the output pattern, so we don&#8217;t have to do anything.</p>



<p class="wp-block-paragraph">now we look at the y the y had a left child of 22 but that&#8217;s already taken care of in the output</p>



<p class="wp-block-paragraph">pattern so we don&#8217;t have to worry about that it also had a right child of 42</p>



<p class="wp-block-paragraph">um so we don&#8217;t have to worry about that sorry we do have to worry about that so i&#8217;m going to copy</p>



<p class="wp-block-paragraph">the 42 over here and we&#8217;re going to have to do something with it eventually now we&#8217;re ready to</p>



<p class="wp-block-paragraph">If we&#8217;re looking at the X node, X node is 22.</p>



<p class="wp-block-paragraph">It had a right child of 27 that is not in the output pattern.</p>



<p class="wp-block-paragraph">So that&#8217;s something that&#8217;s unaccounted for.</p>



<p class="wp-block-paragraph">I&#8217;m going to place it over here.</p>



<p class="wp-block-paragraph">Okay, now we&#8217;re ready to attach the nodes in the output pattern.</p>



<p class="wp-block-paragraph">Let me just bring something to your attention real fast.</p>



<p class="wp-block-paragraph">Notice how the 42 node, which was an outstanding child of one of the output pattern nodes,</p>



<p class="wp-block-paragraph">it had a child of its own, right?</p>



<p class="wp-block-paragraph">on the bottom here, you know, below the output pattern, if they had any children of their</p>



<p class="wp-block-paragraph">own, we would not like change their topology. We would not assign them to different parents.</p>



<p class="wp-block-paragraph">They would just stay exactly where they are, which means just for the purposes of this diagram,</p>



<p class="wp-block-paragraph">I should probably also bring the 55 down as the right child of the 42. So I can remember,</p>



<p class="wp-block-paragraph">you know, that it was there and not totally forget it and ruin the tree.</p>



<p class="wp-block-paragraph">27 had no children, so it&#8217;s fine. The 27 should be a left child of 34 because it&#8217;s greater than</p>



<p class="wp-block-paragraph">of 34 because it&#8217;s greater than 22 and it&#8217;s less than 34 so I&#8217;m going to stick it right there and</p>



<p class="wp-block-paragraph">then where would the 42 go well it would it would be a right child of 34 because it&#8217;s greater than</p>



<p class="wp-block-paragraph">34 so maybe I should make the 27 like just a little bit more to the left okay then I&#8217;m going</p>



<p class="wp-block-paragraph">to reconnect so the 34&#8217;s left child is 27 its right child is 42 and then you know this is easy</p>



<p class="wp-block-paragraph">like I make mistakes all the time too so I just want to double check that this is a valid binary</p>



<p class="wp-block-paragraph">search tree because I could have you know done the numbers incorrectly so we have 15 22 27 34 42 55</p>



<p class="wp-block-paragraph">it all increases it is a binary tree so it&#8217;s also a binary search tree and then it&#8217;s like</p>



<p class="wp-block-paragraph">it satisfies all the other properties so now how many nodes did I actually remove four five six and</p>



<p class="wp-block-paragraph">there were only six nodes in the entire tree before we did this rotation you know z is kind of the</p>



<p class="wp-block-paragraph">know z is kind of the culprit of why this happened so that means the rotated pattern is actually the</p>



<p class="wp-block-paragraph">final binary search tree so i&#8217;m just going to erase the whole entire tree and put the rotated</p>



<p class="wp-block-paragraph">pattern in the middle here then we just have to recompute all the balance factors to make sure</p>



<p class="wp-block-paragraph">that we&#8217;re done or that we&#8217;re not done so the leaves get zero and then the 42 gets a one and</p>



<p class="wp-block-paragraph">then the 34 gets a one because it&#8217;s got a height of one on its left subtree and a height of two on</p>



<p class="wp-block-paragraph">and a height of 2 on its right subtree, take the absolute value.</p>



<p class="wp-block-paragraph">The 22 node, I don&#8217;t think that&#8217;s quite finished yet.</p>



<p class="wp-block-paragraph">It&#8217;s got a balance factor of 2 because it&#8217;s here.</p>



<p class="wp-block-paragraph">Let&#8217;s just clarify to make sure everybody&#8217;s on the same page.</p>



<p class="wp-block-paragraph">Anytime I feel that I had to think even a little bit,</p>



<p class="wp-block-paragraph">I&#8217;ll sometimes just kind of take a little step back and make sure everybody&#8217;s okay.</p>



<p class="wp-block-paragraph">So the left subtree has a height of 1.</p>



<p class="wp-block-paragraph">You can see that I highlighted the left subtree.</p>



<p class="wp-block-paragraph">The right subtree has a height of 1, 2, 3.</p>



<p class="wp-block-paragraph">So 1 minus 3, take the absolute value.</p>



<p class="wp-block-paragraph">That&#8217;s going to be 2.</p>



<p class="wp-block-paragraph">value that&#8217;s going to be two so the balance factor of the 22 node is two meaning we&#8217;re not done</p>



<p class="wp-block-paragraph">rotating our tree it could be a little bit better a little bit faster so maybe i&#8217;m going to move this</p>



<p class="wp-block-paragraph">whole thing over to the left a little bit and then we&#8217;ll call the 22 node the z node because it&#8217;s the</p>



<p class="wp-block-paragraph">first node that&#8217;s out of whack then we have some more interesting choices right remember before</p>



<p class="wp-block-paragraph">if we&#8217;re going to go down into the left or down into the right it always seemed obvious but now</p>



<p class="wp-block-paragraph">seemed obvious but now to find our y we could go left or right but we have to go to the right</p>



<p class="wp-block-paragraph">because 34 has the taller subtree 15 it&#8217;s it&#8217;s a tree of just one it&#8217;s a height of one and 34 it&#8217;s</p>



<p class="wp-block-paragraph">a tree of height three so we go to the right to find y to find x again we need to look at a child</p>



<p class="wp-block-paragraph">of y with the tallest subtree so that&#8217;s not going to be 27 that&#8217;s a height of one it&#8217;s going to be</p>



<p class="wp-block-paragraph">42 with the height of two so the x node is this over here and now we&#8217;re ready to talk about</p>



<p class="wp-block-paragraph">ready to talk about what is XYZ and ABC. So X is, I always forget to change the color before I type</p>



<p class="wp-block-paragraph">this. Okay. X is 42. Y is 34. Z is 22. And then we get A and B and C. Okay, so A is the least value,</p>



<p class="wp-block-paragraph">the one that would belong on the left. I mean, you can just look visually on the diagram again.</p>



<p class="wp-block-paragraph">on the left right so that would have to be a because anything that starts leftmost should end</p>



<p class="wp-block-paragraph">up left leftmost in terms of a well-drawn diagram so b is going to be in the middle that&#8217;s the 34</p>



<p class="wp-block-paragraph">and then c is going to be the greatest value which is 42 again c 42 is the rightmost value both</p>



<p class="wp-block-paragraph">before and after we decided what is a xyz and abc so we&#8217;ve got that i&#8217;m going to go ahead and start</p>



<p class="wp-block-paragraph">for another new diagram.</p>



<p class="wp-block-paragraph">We&#8217;re going to say,</p>



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



<p class="wp-block-paragraph">Give it a little copy.</p>



<p class="wp-block-paragraph">Give it another little copy.</p>



<p class="wp-block-paragraph">Give it a copy.</p>



<p class="wp-block-paragraph">Then I&#8217;m going to draw my connections.</p>



<p class="wp-block-paragraph">Dang, how long is this video?</p>



<p class="wp-block-paragraph">Man, I knew this was going to be a gnarly example.</p>



<p class="wp-block-paragraph">That&#8217;s why I like doing it.</p>



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



<p class="wp-block-paragraph">Fix the numbers real fast.</p>



<p class="wp-block-paragraph">So the 27 is A, it&#8217;s 22.</p>



<p class="wp-block-paragraph">And then this is going to be B, which is 34.</p>



<p class="wp-block-paragraph">And then 27, or the rightmost node, is going to be the 42.</p>



<p class="wp-block-paragraph">Then we start looking at children that might be unaccounted for in our target pattern.</p>



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



<p class="wp-block-paragraph">And we&#8217;ll say, start by looking at Z.</p>



<p class="wp-block-paragraph">It had a left child of 15, which is unaccounted for in the output pattern.</p>



<p class="wp-block-paragraph">So I&#8217;m going to move 15 over here somewhere.</p>



<p class="wp-block-paragraph">And then we look at the 34.</p>



<p class="wp-block-paragraph">That&#8217;s already accounted for in the output pattern.</p>



<p class="wp-block-paragraph">So we&#8217;re done looking at Z&#8217;s children.</p>



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



<p class="wp-block-paragraph">Now we&#8217;re ready to look at Y.</p>



<p class="wp-block-paragraph">Y had a left child of 27.</p>



<p class="wp-block-paragraph">That&#8217;s actually unaccounted for.</p>



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



<p class="wp-block-paragraph">I&#8217;m going to copy the 27 over here.</p>



<p class="wp-block-paragraph">And then we look at the 42.</p>



<p class="wp-block-paragraph">The 42 is already handled in the output pattern.</p>



<p class="wp-block-paragraph">So we don&#8217;t have to worry about it.</p>



<p class="wp-block-paragraph">worry about it okay now we&#8217;re ready to look at the x nodes children so we look at x it had a right</p>



<p class="wp-block-paragraph">child of 55 that&#8217;s also that&#8217;s also not accounted for in the output pattern so i&#8217;m going to make a</p>



<p class="wp-block-paragraph">copy so we have like three nodes to worry about and then you know just for diagram purposes in</p>



<p class="wp-block-paragraph">the code this would be easy to do but for the diagram we have to make sure are we dragging any</p>



<p class="wp-block-paragraph">of these unaccounted for children away from their other children that they might have so 55 it has</p>



<p class="wp-block-paragraph">children 27 it has no children 15 also has no children so these are pretty easy so just visually</p>



<p class="wp-block-paragraph">I&#8217;m going to rearrange I lost my camera what happened test test test whoa I&#8217;m tripping so I</p>



<p class="wp-block-paragraph">had a technical issue with my camera I had to edit out I guess a little portion where I was super</p>



<p class="wp-block-paragraph">confused and screaming and now I think we&#8217;re okay so we can continue the video so we&#8217;ve just looked</p>



<p class="wp-block-paragraph">children that are unaccounted for and accounted for them that&#8217;s so nice of us</p>



<p class="wp-block-paragraph">and we&#8217;re going to have to place them somewhere so this 15 again it can&#8217;t go</p>



<p class="wp-block-paragraph">anywhere over here on the right side that would be an invalid binary search</p>



<p class="wp-block-paragraph">tree it&#8217;s actually got to go on the left of the 22</p>



<p class="wp-block-paragraph">it&#8217;s the only place it could possibly go same thing for the 55 where is that</p>



<p class="wp-block-paragraph">going to go I don&#8217;t know maybe like all the way to the right because that&#8217;s the</p>



<p class="wp-block-paragraph">only numerically valid you know place that it could go to have a valid binary</p>



<p class="wp-block-paragraph">27 can&#8217;t go on the right of 34 it&#8217;s too small it ends up going on the right of 22.</p>



<p class="wp-block-paragraph">So now we&#8217;ve placed the children to account for them and I&#8217;m going to just like draw my</p>



<p class="wp-block-paragraph">connecting lines real fast and then how many nodes do we have here let&#8217;s see the 22</p>



<p class="wp-block-paragraph">1 2 3 4 5 6 1 2 3 4 5 6 oh actually that&#8217;s every single node in the tree just like last time we</p>



<p class="wp-block-paragraph">again guess that that would have happened because it might be likely to happen because the z node</p>



<p class="wp-block-paragraph">here was actually the root node of the tree. So I&#8217;m just going to you know replace the entire tree</p>



<p class="wp-block-paragraph">and say that we&#8217;re done rotating now. So we&#8217;ll just do this put this in the middle and then</p>



<p class="wp-block-paragraph">recompute all the balance factors just to check to see if we&#8217;re done. You can probably tell already</p>



<p class="wp-block-paragraph">this is a pretty decent tree so we might not have to rotate but I&#8217;m going to go ahead and</p>



<p class="wp-block-paragraph">have to rotate but I&#8217;m going to go ahead and just double check anyway. So the leaves get zeros</p>



<p class="wp-block-paragraph">and the 22 gets a zero because it&#8217;s got left and right subtrees of equal height. The 42 has a one</p>



<p class="wp-block-paragraph">and the 34 also has a zero because it&#8217;s left and right subtrees are equal height. This is maybe</p>



<p class="wp-block-paragraph">another good opportunity for me to point out that it&#8217;s not about weight or mass on the left versus</p>



<p class="wp-block-paragraph">right subtrees. It&#8217;s just about height only. So even though there are less nodes in the right</p>



<p class="wp-block-paragraph">The fact remains that the heights are the same. So actually that&#8217;s a zero for the root node</p>



<p class="wp-block-paragraph">This is now finally a valid AVL tree. We have rotated it enough. It is now considered</p>



<p class="wp-block-paragraph">Log time again, it&#8217;s going to be fast to search and insert and remove and all that stuff. So this is pretty great</p>



<p class="wp-block-paragraph">We are now officially done with this example tree. So thank you so much for watching this video</p>



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



<p class="wp-block-paragraph">and I hope you enjoyed doing this tree with me it&#8217;s always a little stressful because it&#8217;s like</p>



<p class="wp-block-paragraph">a half hour tree and I always wonder like did I make a mistake five hours ago I don&#8217;t even know</p>



<p class="wp-block-paragraph">so I guess I&#8217;ll see you in the next video thanks for hanging in there with me</p>



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



<p class="wp-block-paragraph">appreciate it I do hope you did learn something and have some fun if you could do me a please</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 current social media?</p>



<p class="wp-block-paragraph">It&#8217;s a website 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 to keep making videos in general</p>



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



<p class="wp-block-paragraph">You know sometimes I&#8217;m sleeping in the middle of the night and I just wake up because I know somebody subscribed or followed</p>



<p class="wp-block-paragraph">subscribed or followed. It just wakes me up and I get filled with joy. That&#8217;s exactly what happens</p>



<p class="wp-block-paragraph">every single time. So you could do it as a nice favor to me or you could you could troll me if</p>



<p class="wp-block-paragraph">you want to just wake me up in the middle of the night. Just subscribe and then I&#8217;ll just wake up.</p>



<p class="wp-block-paragraph">I promise that&#8217;s what will happen. Also if you look at the middle of the screen right now you</p>



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



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



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



<p class="wp-block-paragraph">good stuff. And, uh, if you have a suggestion for, uh, uh, clarifications or errata or just future</p>



<p class="wp-block-paragraph">videos that you want to see, please leave a comment. Or if you just want to say, Hey, what&#8217;s</p>



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



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



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



<p class="wp-block-paragraph">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">so</p>



<p class="wp-block-paragraph">Hey there! Let&#8217;s rotate an AVL tree…</p>



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



<p class="wp-block-paragraph">Test test test! Whoa, I&#8217;m trippin&#8217;!</p>
<p>The post <a href="https://www.NeuralLantern.com/avl-tree-rotations-practice-balancing-a-huge-linear-tree-step-by-step/">AVL Tree Rotations Practice: Balancing a Huge Linear Tree 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/avl-tree-rotations-practice-balancing-a-huge-linear-tree-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>
		<item>
		<title>Hex to Decimal Made Easy: Fun &#038; Simple Conversion Guide!</title>
		<link>https://www.NeuralLantern.com/hex-to-decimal-made-easy-fun-simple-conversion-guide/</link>
					<comments>https://www.NeuralLantern.com/hex-to-decimal-made-easy-fun-simple-conversion-guide/#respond</comments>
		
		<dc:creator><![CDATA[mike]]></dc:creator>
		<pubDate>Fri, 02 May 2025 09:23:46 +0000</pubDate>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Conversions]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[beginner coding]]></category>
		<category><![CDATA[binary to decimal]]></category>
		<category><![CDATA[coding for beginners]]></category>
		<category><![CDATA[coding guide]]></category>
		<category><![CDATA[computer science basics]]></category>
		<category><![CDATA[computer science tutorial]]></category>
		<category><![CDATA[hex to decimal]]></category>
		<category><![CDATA[hexadecimal to decimal]]></category>
		<category><![CDATA[hexadecimal tutorial]]></category>
		<category><![CDATA[learn to code]]></category>
		<category><![CDATA[number conversion]]></category>
		<category><![CDATA[number systems]]></category>
		<category><![CDATA[programming tutorial]]></category>
		<category><![CDATA[tech education]]></category>
		<guid isPermaLink="false">https://www.NeuralLantern.com/?p=95</guid>

					<description><![CDATA[<p>Learn to convert hexadecimal to decimal with this fun, easy guide! Perfect for beginners in coding and computer science. #HexToDecimal #LearnToCode</p>
<p>The post <a href="https://www.NeuralLantern.com/hex-to-decimal-made-easy-fun-simple-conversion-guide/">Hex to Decimal Made Easy: Fun &amp; Simple Conversion Guide!</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="Hex to Decimal Made Easy: Fun &amp; Simple Conversion Guide!" width="1380" height="776" src="https://www.youtube.com/embed/yDk-fB52i0A?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">Confused by hexadecimal numbers? Don’t worry! This fun, step-by-step guide makes converting hex to decimal super easy, even for beginners. With clear examples and a chill vibe, you’ll master this computer science skill in no time. Perfect for students, coders, or anyone curious about number systems. Hit subscribe for more coding tutorials, and check out our site for extra resources! #HexToDecimal #CodingForBeginners #ComputerScience #LearnToCode</p>



<p class="wp-block-paragraph">Introduction to Hexadecimal Conversion 00:00:00<br>Purpose of Conversion 00:00:11<br>Number System Basics 00:00:39<br>Hexadecimal Explanation 00:01:12<br>Converting Hex to Decimal 00:01:59<br>First Example Setup 00:02:35<br>Decimal Place Value Recap 00:03:02<br>Hexadecimal Place Value 00:05:14<br>Formula for Conversion 00:05:43<br>Translating Hex Letters 00:08:17<br>First Example Calculation 00:09:51<br>Second Example Introduction 00:11:14<br>Second Example Conversion 00:11:58<br>Second Example Result 00:13:11<br>Conclusion and Call to Action 00:14:00</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>
</ul>



<p class="wp-block-paragraph">Please help support us!</p>



<ul class="wp-block-list">
<li>Subscribing + Sharing on Social Media</li>



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



<li>Subscribing to our Blog</li>



<li>Watching 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 talk about converting hexadecimal to decimal.</p>



<p class="wp-block-paragraph">So why would you do this? Of course, sometimes in computer science and other realms, you may be</p>



<p class="wp-block-paragraph">faced with a number that looks like this, and it&#8217;s got some letters in there, and it&#8217;s weird,</p>



<p class="wp-block-paragraph">and you&#8217;re thinking, oops, not a V. That wouldn&#8217;t work. Not a G. And you&#8217;re thinking like, what does</p>



<p class="wp-block-paragraph">what does this number mean in decimal well this is a number that is real and we can just change</p>



<p class="wp-block-paragraph">the way it&#8217;s represented uh to decimal so that we can understand what it is so just like a quick</p>



<p class="wp-block-paragraph">recap if you haven&#8217;t watched my other videos yet uh in decimal we have a base 10 system which just</p>



<p class="wp-block-paragraph">basically means we have these characters zero one two three four five six seven eight nine there</p>



<p class="wp-block-paragraph">base is 10. In binary, of course, we have base two, which is just, you know, we have a zero and a one</p>



<p class="wp-block-paragraph">because in the computer, which is why we learn binary, we just have on and off basically for</p>



<p class="wp-block-paragraph">every single, you know, part of the computer. There&#8217;s just like a certain voltage or there&#8217;s</p>



<p class="wp-block-paragraph">not a certain voltage and that&#8217;s it. And then for hexadecimal, which is a way to represent the same</p>



<p class="wp-block-paragraph">numbers, but just in a more compact way. It&#8217;s a little bit more compact than decimal. It&#8217;s a lot</p>



<p class="wp-block-paragraph">than binary we can say that this is base 16 which means we have 16 total characters that we can work</p>



<p class="wp-block-paragraph">with zero one two three four five six seven eight nine and once we run out of numbers we just start</p>



<p class="wp-block-paragraph">using letters so a b c d e f so there are 16 total characters if we include the zero which means we</p>



<p class="wp-block-paragraph">So that&#8217;s the basics of you know the number basis let&#8217;s uh let&#8217;s work out how to convert a hex</p>



<p class="wp-block-paragraph">number to decimal. So I&#8217;m going to say ox because in hex when you write down a hex number you should</p>



<p class="wp-block-paragraph">usually put ox in front of it unless the program you&#8217;re working with doesn&#8217;t understand that but</p>



<p class="wp-block-paragraph">usually especially for a human reader you should do it this way. So I&#8217;m going to just type like a</p>



<p class="wp-block-paragraph">few random maybe I have to I have to keep the number small because hex will explode it&#8217;ll be</p>



<p class="wp-block-paragraph">not careful. So I&#8217;m going to put like a I don&#8217;t know, maybe a few decimal numbers there or a few</p>



<p class="wp-block-paragraph">like digits that are zero to nine, then I&#8217;ll just to make it more interesting, I&#8217;ll put some letters</p>



<p class="wp-block-paragraph">in there. How about like an E there? And then I don&#8217;t know, like, we&#8217;ll do a B there. Okay, so</p>



<p class="wp-block-paragraph">how many do I have? 12341234? How about we get rid of? Now, let&#8217;s go for it. This is going to be an</p>



<p class="wp-block-paragraph">So this is our starting number hexadecimal. What we need to do is understand that, well,</p>



<p class="wp-block-paragraph">a recap if you haven&#8217;t watched my other videos yet. In decimal we have, let&#8217;s say, 0, 1, 2, 3,</p>



<p class="wp-block-paragraph">4, 5, 6. You know that the first digit has a strength of 1. You multiply 6 by 1 to understand</p>



<p class="wp-block-paragraph">the real power of that 6. For the 5, you know that it has a power of 10 or a strength of 10</p>



<p class="wp-block-paragraph">10 because it&#8217;s the next digit over you know to the left same thing for the four it&#8217;s like got a</p>



<p class="wp-block-paragraph">strength of 100 and so every time you move to the left the strength of the digit increases by a</p>



<p class="wp-block-paragraph">factor of 10. why does it increase by a factor of 10 because decimal is base 10 because we have 10</p>



<p class="wp-block-paragraph">possible digits we can represent for each character okay so by the time we get to that</p>



<p class="wp-block-paragraph">left, we have a strength of 100,000. So, you know, if you wanted to really understand 100,000,</p>



<p class="wp-block-paragraph">if you really wanted to understand, you know, how powerful, let me, let me give some spacing here.</p>



<p class="wp-block-paragraph">So this feels better. Okay. If you really wanted to understand like, you know, what is the strength?</p>



<p class="wp-block-paragraph">What is like the actual value of this digit right here? You&#8217;re imagining this is like 100,000.</p>



<p class="wp-block-paragraph">this digit here you&#8217;re imagining that this is two of ten thousand you know two times ten thousand</p>



<p class="wp-block-paragraph">and so forth so uh uh just like another recap the first digit is really 10 to the zero power</p>



<p class="wp-block-paragraph">like in terms of the strength because if you multiply um let me pin this to the top</p>



<p class="wp-block-paragraph">if you multiply you know 10 to the something power and you start at zero with the most</p>



<p class="wp-block-paragraph">the weakest digit 10 to the zero power gives a strength of one and then every time you move over</p>



<p class="wp-block-paragraph">to the left you just increase the exponent there by one so 10 to the first power is going to be 10</p>



<p class="wp-block-paragraph">that&#8217;s what that five has got so it&#8217;ll be five times 10 to give us an understanding of how you</p>



<p class="wp-block-paragraph">know powerful that digit is move one over to the left it&#8217;s 10 to the second power so that&#8217;s 100</p>



<p class="wp-block-paragraph">move one over to the left it&#8217;s 10 to the third power and so forth until we get to 10 to the fifth</p>



<p class="wp-block-paragraph">1 times 10 to the fifth power to understand how powerful that is so we can do the same exact thing</p>



<p class="wp-block-paragraph">with hexadecimal except instead of raising 10 to a power we raise 16 to a power because hexadecimal</p>



<p class="wp-block-paragraph">is base 16 whereas decimal is base 10. so that means this e is is uh you know 10 to the or sorry</p>



<p class="wp-block-paragraph">16 to the zero power and then that 3 is 16 to the 1 power and that f is 16 to the 2 power and so</p>



<p class="wp-block-paragraph">16 to the 2 power and so forth so first what we should do is let&#8217;s write out a</p>



<p class="wp-block-paragraph">formula which won&#8217;t work in a calculator because we&#8217;re going to put some letters</p>



<p class="wp-block-paragraph">in there and then later we&#8217;ll translate the letters to actual values so we&#8217;ll</p>



<p class="wp-block-paragraph">start off with the e we&#8217;ll say e times 16 to the something power it&#8217;s going to be</p>



<p class="wp-block-paragraph">16 to the zero power okay so then the next digit is 3 so 3 times 16 to the</p>



<p class="wp-block-paragraph">And then the next thing is going to be F times 16 to the second power.</p>



<p class="wp-block-paragraph">And just as a reminder here, I&#8217;m starting with zero with the smallest digit.</p>



<p class="wp-block-paragraph">And I&#8217;m just working my way up in steps of one.</p>



<p class="wp-block-paragraph">So it&#8217;s zero power or raised to zero and raised to one and raised to two and just so forth all the way to the left.</p>



<p class="wp-block-paragraph">That number will just keep increasing by one.</p>



<p class="wp-block-paragraph">The exponent will increase by one.</p>



<p class="wp-block-paragraph">times 16 to the third power do it again um one times 16 to the fourth power do it again</p>



<p class="wp-block-paragraph">um d times 16 to the fourth power oh what did i do did i erase something</p>



<p class="wp-block-paragraph">0, 1, 2, 3, 4, 5.</p>



<p class="wp-block-paragraph">Oh, that was supposed to be a 5.</p>



<p class="wp-block-paragraph">Okay, maybe it&#8217;s good that I thought I made a mistake</p>



<p class="wp-block-paragraph">because that drew my attention to the bad exponent.</p>



<p class="wp-block-paragraph">Okay, so after the D is a B.</p>



<p class="wp-block-paragraph">B times 16 to the 6th power.</p>



<p class="wp-block-paragraph">And then one more.</p>



<p class="wp-block-paragraph">We&#8217;ll say 6 times 16 to the 7th power.</p>



<p class="wp-block-paragraph">And then another one.</p>



<p class="wp-block-paragraph">A times 16 to the, whoops, to the eighth power.</p>



<p class="wp-block-paragraph">And another one.</p>



<p class="wp-block-paragraph">One times 16 to the ninth power.</p>



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



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



<p class="wp-block-paragraph">So just double check your work real fast.</p>



<p class="wp-block-paragraph">You know, because I make typos all the time and I get things wrong all the time.</p>



<p class="wp-block-paragraph">So just double check.</p>



<p class="wp-block-paragraph">Zero, one, two, three, four, five, six, seven, eight, nine.</p>



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



<p class="wp-block-paragraph">Double check the digits.</p>



<p class="wp-block-paragraph">6 b d 1 3 f 3 e okay so i got that right i&#8217;m not going to erase my work because if i end up screwing</p>



<p class="wp-block-paragraph">up the next part oh man is it going to be a hassle to correct so i&#8217;m just going to copy paste it here</p>



<p class="wp-block-paragraph">and then i&#8217;m going to start translating the letters to numbers anytime you see a number here like one</p>



<p class="wp-block-paragraph">time something it&#8217;s just one but every time you see a letter you have to translate that into</p>



<p class="wp-block-paragraph">in decimal. Remember in hex, we&#8217;ll say, what can I do?</p>



<p class="wp-block-paragraph">I can say A, B, C, D, E, F.</p>



<p class="wp-block-paragraph">And I can say that the A is worth 10.</p>



<p class="wp-block-paragraph">The B is worth 11.</p>



<p class="wp-block-paragraph">The C is worth 12.</p>



<p class="wp-block-paragraph">And the D is worth 13.</p>



<p class="wp-block-paragraph">The E is worth 14 and the F is worth 15.</p>



<p class="wp-block-paragraph">Well, maybe I should do the other numbers too.</p>



<p class="wp-block-paragraph">five, six, seven, eight, nine,</p>



<p class="wp-block-paragraph">just so we have a visual reminder</p>



<p class="wp-block-paragraph">of like what we&#8217;re even looking at.</p>



<p class="wp-block-paragraph">And I won&#8217;t write down what the digits are worth</p>



<p class="wp-block-paragraph">because they&#8217;re worth themselves, right?</p>



<p class="wp-block-paragraph">So like zero through nine, it&#8217;s just worth zero through nine.</p>



<p class="wp-block-paragraph">So now that we have this little translation table up here,</p>



<p class="wp-block-paragraph">anytime we see a letter,</p>



<p class="wp-block-paragraph">we can just translate it very quickly to the decimal value.</p>



<p class="wp-block-paragraph">So A is worth 10, we&#8217;ll put a 10 there.</p>



<p class="wp-block-paragraph">Maybe I&#8217;ll add some spacing so that this continues to line up.</p>



<p class="wp-block-paragraph">I see a B here, so the B is gonna be worth 11,</p>



<p class="wp-block-paragraph">11 add another space so it lines up i&#8217;m running out of room but i&#8217;ll try the d is worth 13 add</p>



<p class="wp-block-paragraph">another space so it lines up and then the f is worth 15 add another space so it lines up the e</p>



<p class="wp-block-paragraph">is worth 14 so i&#8217;ll add another space so it lines up okay let me just double check my work here a b d</p>



<p class="wp-block-paragraph">So now I&#8217;ve got like a big formula that I wrote out.</p>



<p class="wp-block-paragraph">I can literally now, I mean, you can do this in your head if you&#8217;re like a crazy genius,</p>



<p class="wp-block-paragraph">but I&#8217;m just going to paste this into a calculator and hit enter.</p>



<p class="wp-block-paragraph">And this is the number that we had originally in hex.</p>



<p class="wp-block-paragraph">Maybe I&#8217;ll put commas here to make things more fun.</p>



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



<p class="wp-block-paragraph">You don&#8217;t really need to do that, but I&#8217;m going to.</p>



<p class="wp-block-paragraph">So for me, it&#8217;s easier to read.</p>



<p class="wp-block-paragraph">this is uh like 113 trillion 478 no wait that&#8217;s a million and that&#8217;s a bill okay so 113 mil a</p>



<p class="wp-block-paragraph">billion 478 million 25 022. let me punch up my personal calculator here to make sure that i&#8217;m</p>



<p class="wp-block-paragraph">getting this right i&#8217;m not going to show this on the screen because i&#8217;ve just got this up</p>



<p class="wp-block-paragraph">on my host machine bet you didn&#8217;t know i&#8217;m inside of vm right now surprised you didn&#8217;t know that</p>



<p class="wp-block-paragraph">decimal and the number is supposed to be 113478025022 okay so we did this right we now know how</p>



<p class="wp-block-paragraph">to convert from hexadecimal to decimal and it&#8217;s pretty awesome right okay let&#8217;s do another number</p>



<p class="wp-block-paragraph">one that is not quite as hard let&#8217;s see how many digits do we have here one two three i think we</p>



<p class="wp-block-paragraph">5, 6, 7, 8, 9, 10.</p>



<p class="wp-block-paragraph">Yeah, okay, we had 10.</p>



<p class="wp-block-paragraph">Let&#8217;s do a five-digit hex number.</p>



<p class="wp-block-paragraph">Okay, maybe I&#8217;ll copy…</p>



<p class="wp-block-paragraph">I&#8217;ll copy just this table at the top</p>



<p class="wp-block-paragraph">since you don&#8217;t need it anymore,</p>



<p class="wp-block-paragraph">but I&#8217;m going to need it to do my calculations.</p>



<p class="wp-block-paragraph">So we&#8217;ll do 1, 2, 3, 4, 5,</p>



<p class="wp-block-paragraph">and I&#8217;ll just start randomly changing</p>



<p class="wp-block-paragraph">some of these numbers.</p>



<p class="wp-block-paragraph">Like an 8 over here, and how about like a 2?</p>



<p class="wp-block-paragraph">So I&#8217;ve got five numbers.</p>



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



<p class="wp-block-paragraph">I&#8217;m going to say this is a hexadecimal number.</p>



<p class="wp-block-paragraph">Kind of ambiguous if we tell the reader this is a hex number,</p>



<p class="wp-block-paragraph">but then we put OX.</p>



<p class="wp-block-paragraph">Kind of don&#8217;t really need to tell them that it&#8217;s hex</p>



<p class="wp-block-paragraph">because OX tells you it&#8217;s hex.</p>



<p class="wp-block-paragraph">It&#8217;s not even part of the value.</p>



<p class="wp-block-paragraph">So let&#8217;s get on with it.</p>



<p class="wp-block-paragraph">I&#8217;ll start by just doing 8 times 16 to the something power,</p>



<p class="wp-block-paragraph">which is going to be 0 for that first position.</p>



<p class="wp-block-paragraph">the power as we go to the left so it&#8217;s going to be 1 times 16 to the first power and then it&#8217;s</p>



<p class="wp-block-paragraph">going to be f times 16 to the second power and then it&#8217;s going to be 2 times 16 to the third</p>



<p class="wp-block-paragraph">power oh no my thoughts are wandering i think i&#8217;m getting bored of recording this video i&#8217;m starting</p>



<p class="wp-block-paragraph">to the fourth power but honestly why couldn&#8217;t they end up together so and</p>



<p class="wp-block-paragraph">then I think one two three four five okay so that&#8217;s five digits a to f one</p>



<p class="wp-block-paragraph">eight a to f one eight all right zero one two three four just to make sure</p>



<p class="wp-block-paragraph">that I got my exponents right copy paste it so I don&#8217;t have to repeat my work if</p>



<p class="wp-block-paragraph">I get something wrong I&#8217;m gonna translate the letters into numbers so a</p>



<p class="wp-block-paragraph">becomes 10 f becomes 15 and the other numbers are fine as is I can just copy</p>



<p class="wp-block-paragraph">fine as is I can just copy paste this whole thing stick it into a calculator and now I know that</p>



<p class="wp-block-paragraph">this number is actually 667 416 with a little comma in there don&#8217;t put commas if you are taking an</p>



<p class="wp-block-paragraph">exam somewhere if you&#8217;re watching my video to help with your exam because most most likely the exam</p>



<p class="wp-block-paragraph">that you&#8217;re taking will not accept a comma it&#8217;s not been pre-programmed for a comma I don&#8217;t know</p>



<p class="wp-block-paragraph">If you start typing numbers and a comma just shows up, then it probably was programmed for a comma.</p>



<p class="wp-block-paragraph">But don&#8217;t assume it might be a string match and not a numeric match.</p>



<p class="wp-block-paragraph">So be careful out there.</p>



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



<p class="wp-block-paragraph">So 667-416.</p>



<p class="wp-block-paragraph">Let me punch this into my personal calculator just to make sure I got this right and I don&#8217;t have to issue an errata.</p>



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



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



<p class="wp-block-paragraph">We&#8217;ve done it.</p>



<p class="wp-block-paragraph">We know how to convert hexadecimal numbers into decimal numbers.</p>



<p class="wp-block-paragraph">Thank you so much for watching this video. I hope you enjoyed it and had a little bit of fun and</p>



<p class="wp-block-paragraph">learned a little bit of stuff. I&#8217;ll see you in the next video. Hey everybody, thanks for watching</p>



<p class="wp-block-paragraph">this video again from the bottom of my heart. I really appreciate it. I do hope you did learn</p>



<p class="wp-block-paragraph">something and have some fun. If you could do me a please, a small little favor, could you please</p>



<p class="wp-block-paragraph">subscribe and follow this channel or these videos or whatever it is you do on the current social</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 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 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 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.</p>



<p class="wp-block-paragraph">just wake me up in the middle of the night just subscribe and then I&#8217;ll just</p>



<p class="wp-block-paragraph">wake up I promise that&#8217;s what will happen also if you look at the middle of</p>



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



<p class="wp-block-paragraph">to the website which I think is also named somewhere at the bottom of this</p>



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



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



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



<p class="wp-block-paragraph">you just want to say hey what&#8217;s up what&#8217;s going on you know just send me a comment whatever I also</p>



<p class="wp-block-paragraph">wake up for those in the middle of the night I get I wake up in a cold sweat and I&#8217;m like</p>



<p class="wp-block-paragraph">it would really it really mean the world to me I would really appreciate it so again thank you so</p>



<p class="wp-block-paragraph">much for watching this video and enjoy the cool music as as I fade into the darkness which is</p>



<p class="wp-block-paragraph">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/hex-to-decimal-made-easy-fun-simple-conversion-guide/">Hex to Decimal Made Easy: Fun &amp; Simple Conversion Guide!</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.NeuralLantern.com/hex-to-decimal-made-easy-fun-simple-conversion-guide/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
