Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > sci.math > #549916

Re: For WM, a 2-ary infinite tree:

From "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Newsgroups sci.math
Subject Re: For WM, a 2-ary infinite tree:
Date 2022-01-02 21:35 -0800
Organization A noiseless patient Spider
Message-ID <squ1vo$mno$1@dont-email.me> (permalink)
References <sqotum$6ja$1@dont-email.me> <squ1dn$k44$1@dont-email.me>

Show all headers | View raw


On 1/2/2022 9:26 PM, Chris M. Thomasson wrote:
> On 12/31/2021 10:56 PM, Chris M. Thomasson wrote:
>> Root 0, 2-ary:
>>
>>
>> [0]            0
>>                / \
>>               /   \
>>              /     \
>>             /       \
>>            /         \
>> [1]      1           2
>>          / \         / \
>>         /   \       /   \
>> [2]   3     4     5     6
>>       / \   / \   / \   / \
>> [3] 7   8 9  10 11 12 13  14
>> ................................
>>
>> It goes on forever. There is no end. There are an infinite number of 
>> levels, however, no leafs in sight... ;^)
>>
>> Want to get to the number 12, we go: (0, 2, 5, 12), or, starting at 
>> the root, go (R, L, R) RLR... a finite path to 12. Want to get to a 
>> big number, go all rights... (0, 2, 6, 14, ...). Notice a pattern? You 
>> can never reach infinity, even though the tree is infinite in and of 
>> itself...
>>
>> starting at root, 9 = LRL, and 10 = LRR
>>
>> ;^)
>>
>>
>>
>> Want to get to the children of a node? Say 5...
>>
>> left = 2*5+1 = 11
>> right  = 2*5+2 = 12
>>
>> Say, 2...
>>
>> left = 2*2+1 = 5
>> right = 2*2+2 = 6
> [...]
> 
> Funny... Humm.... Lets try to get the parent of say, 11 and 12:
> 
> parent = ceil(11 / 2 - 1) = 5
> parent = ceil(12 / 2 - 1) = 5
> 
> Humm... How about, 6 and 5
> 
> 
> parent = ceil(6 / 2 - 1) = 2
> parent = ceil(5 / 2 - 1) = 2
> 
> How about 1 and 2:
> 
> parent = ceil(1 / 2 - 1) = 0
> parent = ceil(2 / 2 - 1) = 0
> 
> Working! What happens with zero:
> 
> parent = ceil(0 / 2 - 1) = -1
> 
> Humm! Does this going into another realm?
> 
> ;^)
> 
> The parent of 9, or 10:
> 
> parent = ceil(9 / 2 - 1) = 4
> parent = ceil(10 / 2 - 1) = 4
> 
> How about 7, or 8?
> 
> parent = ceil(7 / 2 - 1) = 3
> parent = ceil(8 / 2 - 1) = 3
> 
> 
> Humm... Seems to work out okay for now.

Humm... Let's try to abstract it:

The children of 5 are 11 and 12, lets check:

child_left  = 2*5+1 = 11
child_right = 2*5+2 = 12

The parent of 11 and 12 are 5, lets check:

parent = ceil(11 / 2 - 1) = 5
parent = ceil(12 / 2 - 1) = 5

Therefore,

ceil((2*5+1) / 2 - 1) = 5
ceil((2*5+2) / 2 - 1) = 5


Humm...

left = ary * node_value + 1
right = ary * node_value + 2

and:

parent = ceil(left / ary - 1)
parent = ceil(right / ary - 1)

?

Humm...

Back to sci.math | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

For WM, a 2-ary infinite tree: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-12-31 22:56 -0800
  Re: For WM, a 2-ary infinite tree: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-01-01 00:00 -0800
  Re: For WM, a 2-ary infinite tree: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-01-01 00:03 -0800
    Re: For WM, a 2-ary infinite tree: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-01-01 23:46 -0800
    Re: For WM, a 2-ary infinite tree: FredJeffries <fredjeffries@gmail.com> - 2022-01-02 07:48 -0800
  Re: For WM, a 2-ary infinite tree: "Ross A. Finlayson" <ross.finlayson@gmail.com> - 2022-01-02 09:29 -0800
    Re: For WM, a 2-ary infinite tree: "Ross A. Finlayson" <ross.finlayson@gmail.com> - 2022-01-02 09:54 -0800
      Re: For WM, a 2-ary infinite tree: "Ross A. Finlayson" <ross.finlayson@gmail.com> - 2022-01-02 10:23 -0800
        Re: For WM, a 2-ary infinite tree: Serg io <invalid@invalid.com> - 2022-01-02 13:20 -0600
          Re: For WM, a 2-ary infinite tree: "Ross A. Finlayson" <ross.finlayson@gmail.com> - 2022-01-02 11:27 -0800
            Re: For WM, a 2-ary infinite tree: Serg io <invalid@invalid.com> - 2022-01-02 13:53 -0600
              Re: For WM, a 2-ary infinite tree: "Ross A. Finlayson" <ross.finlayson@gmail.com> - 2022-01-02 11:55 -0800
                Re: For WM, a 2-ary infinite tree: Serg io <invalid@invalid.com> - 2022-01-02 14:01 -0600
                Re: For WM, a 2-ary infinite tree: "Ross A. Finlayson" <ross.finlayson@gmail.com> - 2022-01-02 12:05 -0800
                Re: For WM, a 2-ary infinite tree: Scot Dino <cvb@nmo.er> - 2022-01-02 23:30 +0000
                Re: For WM, a 2-ary infinite tree: "Ross A. Finlayson" <ross.finlayson@gmail.com> - 2022-01-02 15:38 -0800
                Re: For WM, a 2-ary infinite tree: "Ross A. Finlayson" <ross.finlayson@gmail.com> - 2022-01-02 20:48 -0800
    Re: For WM, a 2-ary infinite tree: Scot Dino <cvb@nmo.er> - 2022-01-02 18:08 +0000
  Re: For WM, a 2-ary infinite tree: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-01-02 21:26 -0800
    Re: For WM, a 2-ary infinite tree: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-01-02 21:35 -0800
      Re: For WM, a 2-ary infinite tree: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-01-03 00:10 -0800
        Re: For WM, a 2-ary infinite tree: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-01-03 01:17 -0800

csiph-web