do not compile yet
authorxchaos <xchaos@4bb87942-c103-4e5a-b51c-0ebff58f8515>
Mon, 12 May 2008 21:29:34 +0000 (21:29 +0000)
committerxchaos <xchaos@4bb87942-c103-4e5a-b51c-0ebff58f8515>
Mon, 12 May 2008 21:29:34 +0000 (21:29 +0000)
git-svn-id: https://dev.arachne.cz/repos/cll1h/trunk@71 4bb87942-c103-4e5a-b51c-0ebff58f8515

demos/trees.c

index 44c9ad5903c6eda277c02ad921ffa69dbea5bf16..dff0ddafdeea0213c17f41f1ed2a0e3b4c2f500b 100644 (file)
@@ -22,24 +22,25 @@ program
 
   //grow tree
   {
-    void *prev = NULL, *newleaf = leaf;
-
+    void *prev=NULL, *newleaf=leaf;
     //find where to store
-    for(leaf=root; leaf && leaf->__key <= newkey ; leaf=leaf->__next)
+    for(leaf=root; leaf && leaf->__key<=newkey ; leaf=leaf->__next)
     {
-     prev = leaf;
-     if(leaf->__seek && leaf->__seek->key <= newkey) leaf=leaf->__seek;
+     prev=leaf;
+     if(leaf->__seek && leaf->__seek->key<=newkey) leaf=leaf->__seek;
     }
-    
     //store new node
+    leaf=newleaf;
     if(prev)
     {
-    
+     leaf->__next=prev->__next->__next;
+     prev->__next=leaf;
     }
     else
-    {
-    
-    }
+     leaf->__next=root;
+    //auto seek
+    if(leaf->__next->__next;)
+     leaf->__seek=leaf->__next->__next;
     
     //reindex B+ tree
     for(leaf=root; leaf->__next ; leaf=leaf->__next)
This page took 0.139165 seconds and 4 git commands to generate.