<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mojopuzzler.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Binary_Tree</id>
	<title>Binary Tree - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mojopuzzler.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Binary_Tree"/>
	<link rel="alternate" type="text/html" href="https://mojopuzzler.org/mediawiki/index.php?title=Binary_Tree&amp;action=history"/>
	<updated>2026-05-05T21:06:58Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.1</generator>
	<entry>
		<id>https://mojopuzzler.org/mediawiki/index.php?title=Binary_Tree&amp;diff=2248&amp;oldid=prev</id>
		<title>Gneale at 15:43, 17 November 2023</title>
		<link rel="alternate" type="text/html" href="https://mojopuzzler.org/mediawiki/index.php?title=Binary_Tree&amp;diff=2248&amp;oldid=prev"/>
		<updated>2023-11-17T15:43:41Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:43, 17 November 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l21&quot;&gt;Line 21:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 21:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         256             510 257              511&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         256             510 257              511&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;H2&amp;gt;Binary Tree example and explanation(as per Jakub Hadamcik 2021-07-10)&amp;lt;/H2&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;H2&amp;gt;Binary Tree example and explanation(as per Jakub Hadamcik &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;@hadamcik &lt;/ins&gt;2021-07-10)&amp;lt;/H2&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Btw there is (fairly) simple way how to calculate which # you want just by looking at solution (instead of writing very deep tree).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Btw there is (fairly) simple way how to calculate which # you want just by looking at solution (instead of writing very deep tree).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff::1.12:old-2246:rev-2248 --&gt;
&lt;/table&gt;</summary>
		<author><name>Gneale</name></author>
	</entry>
	<entry>
		<id>https://mojopuzzler.org/mediawiki/index.php?title=Binary_Tree&amp;diff=2246&amp;oldid=prev</id>
		<title>Gneale: Created page with &quot;===== Return to: Chialisp =====                            1                          / \                         /   \                        /     \                       /       \                      /         \                     /           \                    2             3                   / \           / \                  /   \         /   \                 4      6      5     7                / \    / \    / \   / \               8   12 10  14...&quot;</title>
		<link rel="alternate" type="text/html" href="https://mojopuzzler.org/mediawiki/index.php?title=Binary_Tree&amp;diff=2246&amp;oldid=prev"/>
		<updated>2023-11-17T15:42:49Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;===== Return to: &lt;a href=&quot;/mediawiki/index.php/Chialisp&quot; title=&quot;Chialisp&quot;&gt;Chialisp&lt;/a&gt; =====                            1                          / \                         /   \                        /     \                       /       \                      /         \                     /           \                    2             3                   / \           / \                  /   \         /   \                 4      6      5     7                / \    / \    / \   / \               8   12 10  14...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;===== Return to: [[Chialisp|Chialisp]] =====&lt;br /&gt;
&lt;br /&gt;
                          1&lt;br /&gt;
                         / \&lt;br /&gt;
                        /   \&lt;br /&gt;
                       /     \&lt;br /&gt;
                      /       \&lt;br /&gt;
                     /         \&lt;br /&gt;
                    /           \&lt;br /&gt;
                   2             3&lt;br /&gt;
                  / \           / \&lt;br /&gt;
                 /   \         /   \&lt;br /&gt;
                4      6      5     7&lt;br /&gt;
               / \    / \    / \   / \&lt;br /&gt;
              8   12 10  14 9  13 11  15&lt;br /&gt;
              ^    ^  ^   ^ ^   ^  ^   ^&lt;br /&gt;
    16-24 20-28 18-26 22-30 17-25 21-29 19-27 23-31  &lt;br /&gt;
         32-48            62 33            47-63&lt;br /&gt;
        64-96            126 65             95-127&lt;br /&gt;
         128            254 129             255&lt;br /&gt;
        256             510 257              511&lt;br /&gt;
&lt;br /&gt;
&amp;lt;H2&amp;gt;Binary Tree example and explanation(as per Jakub Hadamcik 2021-07-10)&amp;lt;/H2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Btw there is (fairly) simple way how to calculate which # you want just by looking at solution (instead of writing very deep tree).&lt;br /&gt;
&lt;br /&gt;
If you have for example &amp;lt;code&amp;gt;(1 2 (((5 6) 4) 3))&amp;lt;/code&amp;gt; and you want to know which # gets you atom for position of number 6 in that solution you just need to decode it into set of left/right (first/rest.. whatever works for you, it's same)&lt;br /&gt;
&lt;br /&gt;
So you start with `1` as first and &amp;lt;code&amp;gt;(2 (((5 6) 4) 3))&amp;lt;/code&amp;gt; as rest and ask &amp;quot;is number I want on the left or right&amp;quot;.. in this case it's right so you write down `R`&lt;br /&gt;
&lt;br /&gt;
And you continue `2` and rest &amp;lt;code&amp;gt;(((5 6) 4) 3)&amp;lt;/code&amp;gt; =&amp;gt; `R`&lt;br /&gt;
&lt;br /&gt;
So whole process is:&lt;br /&gt;
&lt;br /&gt;
`1` and rest &amp;lt;code&amp;gt;(2 (((5 6) 4) 3))&amp;lt;/code&amp;gt; =&amp;gt; `R`&lt;br /&gt;
&lt;br /&gt;
`2` and rest &amp;lt;code&amp;gt;((((5 6) 4) 3))&amp;lt;/code&amp;gt; =&amp;gt; `R`&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;(((5 6) 4) 3)&amp;lt;/code&amp;gt; and rest &amp;lt;code&amp;gt;()&amp;lt;/code&amp;gt; =&amp;gt; `L`&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;((5 6) 4)&amp;lt;/code&amp;gt; and rest &amp;lt;code&amp;gt;(3)&amp;lt;/code&amp;gt;=&amp;gt; `L`&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;(5 6)&amp;lt;/code&amp;gt; and rest &amp;lt;code&amp;gt;(4)&amp;lt;/code&amp;gt; =&amp;gt; `L`&lt;br /&gt;
&lt;br /&gt;
`5` and rest &amp;lt;code&amp;gt;(6)&amp;lt;/code&amp;gt; =&amp;gt; `R`&lt;br /&gt;
&lt;br /&gt;
`6` and rest `nil` =&amp;gt; `L`&lt;br /&gt;
&lt;br /&gt;
so result is `RRLLLRL` this you can convert to binary where `R` =&amp;gt; 1 and `L` = 0 so `1100010` &lt;br /&gt;
&lt;br /&gt;
For each position you then need to calculate `2^position*(binary + 1)` and sum those together (sounds harder than it is 😃)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example for `1100010`:&lt;br /&gt;
&lt;br /&gt;
`1`: `2^0 * (1 + 1)` = `2`&lt;br /&gt;
&lt;br /&gt;
`1`: `2^1 * (1 + 1)` = `4`&lt;br /&gt;
&lt;br /&gt;
`0`: `2^2 * (0 + 1)` = `4`&lt;br /&gt;
&lt;br /&gt;
`0`: `2^3 * (0 + 1)` = `8`&lt;br /&gt;
&lt;br /&gt;
`0`: `2^4 * (0 + 1)` = `16`&lt;br /&gt;
&lt;br /&gt;
`1`: `2^5 * (1 + 1)` = `64`&lt;br /&gt;
&lt;br /&gt;
`0`: `2^6 * (0 + 1)` = `64`&lt;br /&gt;
&lt;br /&gt;
and when you sum results: `2+4+4+8+16+64+64` = `162` and add 1 to it (always; because 1 is for root) so final is `163` and &amp;lt;code&amp;gt;brun '163' '(1 2 (((5 6) 4) 3))'&amp;lt;/code&amp;gt; gets you `6`&lt;br /&gt;
&lt;br /&gt;
——————————————&lt;br /&gt;
&lt;br /&gt;
Simpler format is in 2 rows. Top row is 2^position and bottom row is binary where if it's `L` you just take number from top row and if it's `R` you multiply it by 2. So:&lt;br /&gt;
&lt;br /&gt;
 1   2   4   8   16   32   64 ...&lt;br /&gt;
 1   1   0   0   0    1    0&lt;br /&gt;
&lt;br /&gt;
 2 + 4 + 4 + 8 + 16 + 64 + 64 = 162&lt;/div&gt;</summary>
		<author><name>Gneale</name></author>
	</entry>
</feed>