![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Everybody knows that a binary tree is defined by a formula
For the beginners: A tree is either empty (=1) or a triple: (x, t1, t2) where t1 and t2 are also binary trees of the aforementioned kind.
So there. Easy. You can see that this is a quadratic equation, and that it can be represented as a cubic root on a complex plane... it's not about this; let's see how we can store changes in trees, that is, differences, that is, derivatives.
Oh, wait, you probably heard already that
but this equation,
Now
So
An update of a tree can be represented as two trees and a list of triples
But what is it?
The two trees are left and right subtrees of the point-of-change; and the list of triples is the path from the root to the point of change; each element of the path being this:
- left or right
- the changed value
- the intact subtree
On this picture you see gray left, black right, and the path is red values with brown intact subtrees.

Cool eh?
Note, I did not use any particular programming language.
Source: http://www.youtube.com/watch?v=YScIPA8RbVE&noredirect=1
T(x)=1+x*T2(x)
, where x is the type of the value that the tree contains. For the beginners: A tree is either empty (=1) or a triple: (x, t1, t2) where t1 and t2 are also binary trees of the aforementioned kind.
So there. Easy. You can see that this is a quadratic equation, and that it can be represented as a cubic root on a complex plane... it's not about this; let's see how we can store changes in trees, that is, differences, that is, derivatives.
dT/dx = T2 + 2*x*T*dT/dx
, whereby we havedT/dx = T2/(1-2*x*T)
Oh, wait, you probably heard already that
List(x)
is defined by a formula List(x)=1+x*List(x)
, right? Either empty (=1) or a pair (ok, a product) (x, List(x))
, right?but this equation,
List(x)=1+x*List(x)
has a solution, List(x)=1/(1-x)
. Remember this.Now
1/(1-2*x*T)
is a list, List(2*x*T)
So
dT/dx = T2 * List(2*x*T)
An update of a tree can be represented as two trees and a list of triples
(bool, x, T)
, where T
is a tree.But what is it?
The two trees are left and right subtrees of the point-of-change; and the list of triples is the path from the root to the point of change; each element of the path being this:
- left or right
- the changed value
- the intact subtree
On this picture you see gray left, black right, and the path is red values with brown intact subtrees.

Cool eh?
Note, I did not use any particular programming language.
Source: http://www.youtube.com/watch?v=YScIPA8RbVE&noredirect=1
no subject
Date: 2013-07-30 03:47 am (UTC)no subject
Date: 2013-07-30 03:51 am (UTC)no subject
Date: 2013-07-30 04:10 am (UTC)no subject
Date: 2013-07-30 06:09 am (UTC)no subject
Date: 2013-07-30 01:27 pm (UTC)no subject
Date: 2013-07-30 02:37 pm (UTC)no subject
Date: 2013-07-30 03:52 am (UTC)no subject
Date: 2013-07-30 05:02 am (UTC)Kind of.
> Note, I did not use any particular programming language.
Right. But there's a problem:
> Everybody knows that a binary tree is defined by a formula T(x)=1+x*T2(x)
Not everybody knows *that*.
no subject
Date: 2013-07-30 05:03 am (UTC)no subject
Date: 2013-07-30 05:05 am (UTC)no subject
Date: 2013-07-30 08:39 am (UTC)Now, if only I knew what to do with this unconventional knowledge! :)
no subject
Date: 2013-07-30 05:03 am (UTC)2. Why we need intact tree to define change?
no subject
Date: 2013-07-30 05:04 am (UTC)And well... it is actually not the change that we keep, but a "hole", an opportunity for the change. You need to mutliply T' by dx to get dT :)
no subject
Date: 2013-07-30 05:19 am (UTC)(Hmmm, is it correct question? Maybe I must say A = ((*,(*,*)),((*,*),(*,*)))? )
no subject
Date: 2013-07-30 06:05 am (UTC)"Простите меня дядя, больше не буду" :-)
no subject
Date: 2013-07-30 11:09 am (UTC)no subject
Date: 2013-07-30 08:30 am (UTC)no subject
Date: 2013-07-30 05:35 am (UTC)Правда, язык программирования там все-же использовался.
no subject
Date: 2013-07-30 08:28 am (UTC)(your formula misses T)
no subject
Date: 2013-07-30 08:32 am (UTC)no subject
Date: 2013-08-02 11:04 pm (UTC)no subject
Date: 2013-07-30 09:15 am (UTC)no subject
Date: 2013-07-31 12:57 pm (UTC)x=1
. ТогдаT = 1 + T2
. Это уравнение вполне решается, получаются два примитивных корня шестой степени из 1. То есть,T6=1
, что очевидный бред, так как утверждает, что шесть деревьев можно выбрать только одним образом.Но вот
T7=T
— уже не бред. Есть хорошая биекция, работающая за O(1), между семёрками бинарных деревьев и, собственно, бинарными деревьями.no subject
Date: 2013-07-31 06:49 pm (UTC)no subject
Date: 2013-07-31 07:47 pm (UTC)no subject
Date: 2013-08-02 10:56 pm (UTC)Could you please elaborate on this?
no subject
Date: 2013-08-02 11:04 pm (UTC)dT/dx=T^2+2*x*T*dT/dx - that's how it should look like. Fixed in the text
T'=T^2+2xTT' => T'(1-2xT)=T^2 => T'=T^2/(1-2xT).
no subject
Date: 2013-08-02 11:15 pm (UTC)