Grafalgo
Library of useful data structures and algorithms
|
00001 /* @file BalBstSet.h 00002 * @author Jon Turner 00003 * @date 2011 00004 * This is open source software licensed under the Apache 2.0 license. 00005 * See http://www.apache.org/licenses/LICENSE-2.0 for details. 00006 */ 00007 00008 #ifndef BALBSTSET_H 00009 #define BALBSTSET_H 00010 00011 #include "BstSet.h" 00012 00013 namespace grafalgo { 00014 00023 class BalBstSet : public BstSet { 00024 public: 00025 BalBstSet(int); 00026 ~BalBstSet(); 00027 00028 // common methods 00029 void clear(); 00030 void resize(int); 00031 void expand(int); 00032 void copyFrom(const BalBstSet&); 00033 00034 bool insert(index,bst&); 00035 void remove(index,bst&); 00036 bst join(bst,index,bst); 00037 BstSet::BstPair split(index,bst); 00038 protected: 00039 int *rvec; 00040 00041 void swap(index,index); 00042 string& node2string(index,string&) const; 00043 00044 void makeSpace(int); 00045 void freeSpace(); 00046 }; 00047 00048 } // ends namespace 00049 00050 #endif