From: xchaos Date: Mon, 5 May 2008 08:30:28 +0000 (+0000) Subject: some work (do not compile) X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=14e7e05a2fb08966aa8039c31519caa5d4b08a93;p=svn%2FCll1h%2F.git some work (do not compile) git-svn-id: https://dev.arachne.cz/repos/cll1h/trunk@70 4bb87942-c103-4e5a-b51c-0ebff58f8515 --- diff --git a/demos/trees.c b/demos/trees.c index 788989e..44c9ad5 100644 --- a/demos/trees.c +++ b/demos/trees.c @@ -23,12 +23,15 @@ program //grow tree { void *prev = NULL, *newleaf = leaf; + + //find where to store for(leaf=root; leaf && leaf->__key <= newkey ; leaf=leaf->__next) { prev = leaf; if(leaf->__seek && leaf->__seek->key <= newkey) leaf=leaf->__seek; } + //store new node if(prev) { @@ -37,7 +40,18 @@ program { } - + + //reindex B+ tree + for(leaf=root; leaf->__next ; leaf=leaf->__next) + { + if (leaf->__seek) + { + if (leaf->__key <= newkey) + leaf->__seek=leaf->__seek->__next; + } + else + leaf->__seek=leaf->__next->__seek; + } } } }