python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
Why segment tree has to be a binary tree only, why can’t it be ternary, or say n-ary tree, where n >2?
In segment trees , we divide the array into 2 halves and carry it on recursively. Why can’t they be divided into,,let’s day , 3 halves, representing 3 segments. Why is it a binary tree?
aman shrivastava
Votes: 0
Answers: 1
How can I determine quickly how many points of given set does a sphere contains?
Given a set of points in a form of (x, y, z), and a set of spheres in a form of (x, y, z, radius).
The goal is, for each sphere, to count the number of points within the sphere.
I compared the Euclide...
장지훈
Votes: 0
Answers: 2
How can I solve the problem on the segment tree
I have an array a[0..n - 1]. I have 2 types operations:
sum l r:
sum = a[l] * 1 + a[l+1] * 2 + ... + a[r] * (r - l)
update index value: a[index] = value
How can I modify standart sum segment tree fo...
Alex
Votes: 0
Answers: 1
CSES range query section question salary queries problem
I am trying to solve cses salary queries (https://cses.fi/problemset/task/1144/)
Question: I will make a frequency array of salaries and I will use coordinate compression but while update I have to re...
bharat aaryavrat
Votes: 0
Answers: 1