X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=libcds%2Fsrc%2Fstatic_sequence%2Fstatic_sequence_wvtree.cpp;h=ca935948030ec3e3deb5f8c103f5e9de9915484b;hb=e38bc834442d5369a523ba47d74865e48995ace4;hp=1f6bb404cd40108622a6ea07e6419d4646b8856f;hpb=7aba0aca5c8989175fdefe5930c65b1d83606f11;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 1f6bb40..ca93594 100644 --- a/libcds/src/static_sequence/static_sequence_wvtree.cpp +++ b/libcds/src/static_sequence/static_sequence_wvtree.cpp @@ -22,6 +22,7 @@ #include static_sequence_wvtree::static_sequence_wvtree(uint * symbols, uint n, wt_coder * c, static_bitsequence_builder * bmb, alphabet_mapper * am) { + this->n = n; for(uint i=0;imap(symbols[i]); this->am = am; @@ -34,6 +35,7 @@ static_sequence_wvtree::static_sequence_wvtree(uint * symbols, uint n, wt_coder } static_sequence_wvtree::static_sequence_wvtree(uchar * symbols, uint n, wt_coder * c, static_bitsequence_builder * bmb, alphabet_mapper * am) { + this->n = n; for(uint i=0;imap((uint)symbols[i]); this->am = am; @@ -66,7 +68,7 @@ uint static_sequence_wvtree::rank(uint symbol, uint pos) { 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); + uint r = root->rankLessThan(s, pos); symbol = am->unmap(s); return r; } @@ -98,10 +100,10 @@ vector static_sequence_wvtree::access(uint i, uint j, uint min, uint max) vector static_sequence_wvtree::accessAll(uint i, uint j) { vector resultSet; - if (j > i) + if (j < i) return resultSet; - resultSet.reserve(j-i+1); + // resultSet.reserve(j-i+1); // avoid reallocation root->access(resultSet, i, j); for (vector::iterator it = resultSet.begin(); it != resultSet.end(); ++it) *it = am->unmap(*it);