<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-7%3Asdal039</id>
	<title>SE250:lab-7:sdal039 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-7%3Asdal039"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-7:sdal039&amp;action=history"/>
	<updated>2026-04-29T01:16:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.kram.nz/index.php?title=SE250:lab-7:sdal039&amp;diff=7806&amp;oldid=prev</id>
		<title>Mark: 12 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-7:sdal039&amp;diff=7806&amp;oldid=prev"/>
		<updated>2008-11-03T05:20:19Z</updated>

		<summary type="html">&lt;p&gt;12 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Balanced order: &lt;br /&gt;
 d b a c f e g&lt;br /&gt;
 d f e g b a c&lt;br /&gt;
 d c b a e f g&lt;br /&gt;
 d c a b e g f&lt;br /&gt;
 d a b c g f e&lt;br /&gt;
&lt;br /&gt;
There are quite a few more, all starting with d as the root. This is enough to give the idea however...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Rotations to get from right skewed to left skewed tree:&lt;br /&gt;
 Rotate left on root until finished.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Rotations to get from right skewed tree to balanced:&lt;br /&gt;
 right, right, right, right&lt;br /&gt;
 rotate left - at e&lt;br /&gt;
 root&lt;br /&gt;
 rotate left - at a&lt;br /&gt;
 root, right&lt;br /&gt;
 rotate left - at c&lt;br /&gt;
 root&lt;br /&gt;
 rotate left - at b&lt;br /&gt;
&lt;br /&gt;
Difficulty in this was determining which node was the selected, as the (*) was sometimes positioned ambiguously. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add in two new elements and balance&lt;br /&gt;
insert h&lt;br /&gt;
insert i&lt;br /&gt;
&lt;br /&gt;
Need to make e the root&lt;br /&gt;
 starting at root:&lt;br /&gt;
 right - now at f&lt;br /&gt;
 rotate right &lt;br /&gt;
 root - now at d&lt;br /&gt;
 rotate left&lt;br /&gt;
 root&lt;br /&gt;
 right&lt;br /&gt;
 right - now on g&lt;br /&gt;
 rotate left&lt;br /&gt;
&lt;br /&gt;
Tree is now of minimum height.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When an element is added or deleted, the insert function traverses&lt;br /&gt;
a path from the root to the leaf. Is it always possible to rebalance&lt;br /&gt;
the tree by performing rotations only on nodes along this path?&lt;br /&gt;
&lt;br /&gt;
This isn&amp;#039;t always true. If you have the tree&lt;br /&gt;
    d&lt;br /&gt;
  b   e&lt;br /&gt;
        f&lt;br /&gt;
          g&lt;br /&gt;
            h&lt;br /&gt;
&lt;br /&gt;
and add in the element &amp;#039;a&amp;#039; the resulting tree will be&lt;br /&gt;
      d&lt;br /&gt;
    b   e&lt;br /&gt;
  a       f&lt;br /&gt;
            g&lt;br /&gt;
              h&lt;br /&gt;
&lt;br /&gt;
It is not possible to rebalance this tree without rotating elements in the roots right sub tree.&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>