MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / insert

Function insert

Data Structures/Persistent Trie.cpp:36–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34pnode version[N];
35
36void insert(int a, int time) {
37 pnode v = version[time] = last = last->clone();
38 for (int i = K - 1; i >= 0; --i) {
39 int bit = (a >> i) & 1;
40 pnode &child = v->to[bit];
41 child = child->clone();
42 v = child;
43 v->time = time;
44 }
45}
46
47int query(pnode v, int x, int l) {
48 int ans = 0;

Callers 1

solveFunction · 0.70

Calls 1

cloneMethod · 0.80

Tested by

no test coverage detected