File: intersect.cpp

package info (click to toggle)
libsdsl 2.1.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,992 kB
  • sloc: cpp: 42,286; makefile: 1,171; ansic: 318; sh: 201; python: 27
file content (21 lines) | stat: -rw-r--r-- 551 bytes parent folder | download | duplicates (18)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <sdsl/wavelet_trees.hpp>
#include <iostream>

using namespace sdsl;
using namespace std;

int main()
{
    wt_int<> wt;
    //0 1 2 3 4 5 6 7 8 9 0 1 2 3 4  5 6 7 8 9 0  1 2
    construct_im(wt, int_vector<> {1,2,2,4,5,3,2,4,5,3,2,4,7,4,2,52,7,4,2,1,5,74,3});

    cout << "wt = " << wt << endl;
    cout << "wt[0,3] intersect with wt[7,10]" << endl;
    auto res = intersect(wt, {{0,3},{7,10}});
    cout << "element : sum of occurrences in ranges" << endl;
for (auto x : res) {
        cout << x.first << " : " << x.second <<endl;
    }

}