From 14e7e05a2fb08966aa8039c31519caa5d4b08a93 Mon Sep 17 00:00:00 2001 From: xchaos Date: Mon, 5 May 2008 08:30:28 +0000 Subject: [PATCH] some work (do not compile) git-svn-id: https://dev.arachne.cz/repos/cll1h/trunk@70 4bb87942-c103-4e5a-b51c-0ebff58f8515 --- demos/trees.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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; + } } } } -- 2.30.2