some work (do not compile)
authorxchaos <xchaos@4bb87942-c103-4e5a-b51c-0ebff58f8515>
Mon, 5 May 2008 08:30:28 +0000 (08:30 +0000)
committerxchaos <xchaos@4bb87942-c103-4e5a-b51c-0ebff58f8515>
Mon, 5 May 2008 08:30:28 +0000 (08:30 +0000)
git-svn-id: https://dev.arachne.cz/repos/cll1h/trunk@70 4bb87942-c103-4e5a-b51c-0ebff58f8515

demos/trees.c

index 788989ee00e57f8ac5114d34c6a4a78ce98e4c6c..44c9ad5903c6eda277c02ad921ffa69dbea5bf16 100644 (file)
@@ -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;
+    }
   }
  } 
 }
This page took 0.158407 seconds and 4 git commands to generate.