Skip to content

Commit 32f1361

Browse files
authored
Update spoj-cot.mdx
Changed the format of all variable names to snake_case format
1 parent 57448d6 commit 32f1361

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

solutions/advanced/spoj-cot.mdx

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ using namespace std;
4545
int timer = 0;
4646
const int MAX_NODES_GRAPH = 1e5;
4747

48-
struct PersistentSegmentTree {
48+
struct persistent_segment_tree {
4949
static const int MAX_NODES_TREE = 2e6;
5050
int left_child[MAX_NODES_TREE + 1], right_child[MAX_NODES_TREE + 1],
5151
node_value[MAX_NODES_TREE + 1];
@@ -92,20 +92,20 @@ struct PersistentSegmentTree {
9292
int m = (l + r) / 2;
9393

9494
// Calculate the number of elements in the left child of the current range
95-
int leftSubtreeCount = node_value[left_child[a]] + node_value[left_child[b]] -
95+
int left_subtree_count = node_value[left_child[a]] + node_value[left_child[b]] -
9696
node_value[left_child[anc]] - node_value[left_child[pr]];
9797

98-
if (leftSubtreeCount >= k) {
98+
if (left_subtree_count >= k) {
9999
return query(left_child[a], left_child[b], left_child[anc], left_child[pr],
100100
l, m, k);
101101
} else {
102102
return query(right_child[a], right_child[b], right_child[anc],
103-
right_child[pr], m + 1, r, k - leftSubtreeCount);
103+
right_child[pr], m + 1, r, k - left_subtree_count);
104104
}
105105
}
106106
};
107107

108-
PersistentSegmentTree pst;
108+
persistent_segment_tree pst;
109109

110110
struct Graph {
111111
int LOG;

0 commit comments

Comments
 (0)