MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / update

Function update

CPP/Segment Tree/basic.cpp:47–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47void update(vector<int> &tree, int si, int ei, int idx, int index, int val)
48{
49 if (si > index || ei < index)
50 {
51 return;
52 }
53 tree[idx] += val;
54 if (si < ei)
55 {
56 int mid = si + ((ei - si) / 2);
57 update(tree, si, mid, (2 * idx) + 1, index, val);
58 update(tree, mid + 1, ei, (2 * idx) + 2, index, val);
59 }
60}
61
62void update(vector<int> &nums, vector<int> &tree, int index, int val)
63{

Callers 2

mainFunction · 0.85
moveFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected