X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=libcds%2Fsrc%2Fstatic_sequence%2Fstatic_sequence_wvtree.cpp;h=baabf02ffb699af75bd645acdf28a22fe9945d07;hb=a2625dad3e0b32cd0a8ceee350aef39e8412e5b0;hp=d5713ce8ae29ca1f84162b6d616cec57cd5a7b1a;hpb=4e6e8f179979f24c8f77e11eb8f6cc3d609a52d4;p=SXSI%2FXMLTree.git diff --git a/libcds/src/static_sequence/static_sequence_wvtree.cpp b/libcds/src/static_sequence/static_sequence_wvtree.cpp index d5713ce..baabf02 100644 --- a/libcds/src/static_sequence/static_sequence_wvtree.cpp +++ b/libcds/src/static_sequence/static_sequence_wvtree.cpp @@ -40,9 +40,10 @@ static_sequence_wvtree::static_sequence_wvtree(uchar * symbols, uint n, wt_coder am->use(); this->c=c; c->use(); - root = new wt_node_internal(symbols, n, 0, c, bmb); - for(uint i=0;iunmap((uint)symbols[i]); + root = new wt_node_internal(symbols, n, 0, c, bmb); + symbols = 0; // Already deleted! +// for(uint i=0;iunmap((uint)symbols[i]); } static_sequence_wvtree::static_sequence_wvtree() {} @@ -57,6 +58,15 @@ uint static_sequence_wvtree::rank(uint symbol, uint pos) { return root->rank(am->map(symbol), pos, 0, c); } +uint static_sequence_wvtree::rankLessThan(uint &symbol, uint pos) { + uint s = am->map(symbol); + std::cout << "lessthan..." << std::endl; + uint r = root->rankLessThan(s, pos, 0, c); + symbol = am->unmap(s); + return r; +} + + uint static_sequence_wvtree::count(uint s) { return root->rank(am->map(s), len-1, 0, c); }