X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=libcds%2Fsrc%2Fstatic_sequence%2Fwt_node_internal.cpp;h=4e6871a802ddf7bad3f2ec02900376490cb574b1;hb=95f2dabec7cabe4002865e5f9d12651e6e32229a;hp=2219e9b616fba503cfd67263098d6f34b7c167d3;hpb=69d191f9549b65e692b38bfceecc86fbcde474ad;p=SXSI%2FXMLTree.git diff --git a/libcds/src/static_sequence/wt_node_internal.cpp b/libcds/src/static_sequence/wt_node_internal.cpp index 2219e9b..4e6871a 100644 --- a/libcds/src/static_sequence/wt_node_internal.cpp +++ b/libcds/src/static_sequence/wt_node_internal.cpp @@ -250,39 +250,12 @@ uint wt_node_internal::rank(uint symbol, uint pos, uint l, wt_coder * c) { // return value is rank of symbol (less or equal to the given symbol) that has rank > 0, // the parameter symbol is updated accordinly -uint wt_node_internal::rankLessThan(uint &symbol, uint pos, uint l, wt_coder * c) -{ - bool is_set = c->is_set(symbol,l); - using std::cout; - using std::endl; -// cout << "l = " << l << ", symbol = " << (uchar)symbol << ", rank0 = " << bitmap->rank0(pos) << ", rank1 = " << bitmap->rank1(pos) << endl; - - uint result = -1; - if(!is_set) { - if(left_child==NULL) return -1; - uint rank = bitmap->rank0(pos); - if(rank != 0) - result = left_child->rankLessThan(symbol,rank-1,l+1,c); - return result; - } - - uint rank = bitmap->rank1(pos); - if (rank != 0 && right_child != NULL) - result = right_child->rankLessThan(symbol, rank-1,l+1,c); - -// cout << "recursion to leftchild at l = " << l << ", symbol = " << (uchar)symbol << ", rank0 = " << bitmap->rank0(pos) << ", rank1 = " << bitmap->rank1(pos) << endl; - // check left child for symbols <= givenSymbol - if (result != (uint)-1 || left_child == NULL) - return result; - return left_child->rankLessThan(symbol, bitmap->rank0(pos)-1); -} - uint wt_node_internal::rankLessThan(uint &symbol, uint pos) { uint result = -1; using std::cout; using std::endl; -// cout << "pos = " << pos << ", symbol = " << (uchar)symbol << endl; +// cout << "pos = " << pos << ", symbol = " << symbol << endl; if (pos == (uint)-1) return (uint)-1; @@ -429,7 +402,7 @@ void wt_node_internal::access(vector &result, uint i, uint j) } } - +// Count uint wt_node_internal::access(uint i, uint j, uint min, uint max, uint l, uint pivot) { uint count = 0;