Suppose, I've an array [1, 2, 3, 5, 5, 6, 5, 5]
Now, there can be two kind of operation. One of them is "update" operation , that is increase the value in index 4[1 based indexing] by X. Other operation is "query" operation, where given a range, suppose [4, 8](both inclusive) and a value suppose 5. Now find the frequency of the value 5 in the given range [4, 8]. In this case, the answer should be 4.
How can I do this "query" step using segment tree??
Thanks in advance.