Given array , answer: "How many elements in have value in ?" Example: Query : elements in with value in are = count .
Use the same persistent segment tree structure. Instead of finding -th, count elements in a value range.
Count values in bounds
Given array , answer: "How many elements in have value in ?" Example: Query : elements in with value in are = count .
Use the same persistent segment tree structure. Instead of finding -th, count elements in a value range.