X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;ds=sidebyside;f=demos%2Ftrees.c;h=788989ee00e57f8ac5114d34c6a4a78ce98e4c6c;hb=a68153bf02baf64e3b6cbf3da18308636beef4f3;hp=0b8966cf9365ca3c7a3ba00ddca404a29bf885e8;hpb=e4e62ec6b5444d262ad474a4a9a6299cddb1b58a;p=svn%2FCll1h%2F.git diff --git a/demos/trees.c b/demos/trees.c index 0b8966c..788989e 100644 --- a/demos/trees.c +++ b/demos/trees.c @@ -21,16 +21,23 @@ program leaf->__key=newkey; //grow tree - for(leaf=root; leaf && leaf->__key <= newkey ; leaf=leaf->__next) { - if(leaf->__seek->key <= newkey) - { - - } - else - { - - } - } + void *prev = NULL, *newleaf = leaf; + for(leaf=root; leaf && leaf->__key <= newkey ; leaf=leaf->__next) + { + prev = leaf; + if(leaf->__seek && leaf->__seek->key <= newkey) leaf=leaf->__seek; + } + + if(prev) + { + + } + else + { + + } + + } } }