IMPLEMENT THEFOLLOWING ALGORITHM IN C#: PROVIDE A TEST AND PRINT THEOUTPUT
Given n integers inthe range 0 to k-1, the algorithm preprocesses its input in O(n+k)time, then answers a query about how many of the n integers fallinto a range[a.b ]in O(1)time:
The algorithm willbegin by preprocessing count[i] containing the number of elementsless than or equal to i in the array. When queried about how manyintegers fall into a range[a..b], simply computecount[b]?count[a?1]. This takes O(1) times and yields the desiredoutput. See the structure below:
using System;
public class RangeCalculator
{
//O(N+K)
public void preprocess(int[] c)
{
// preprocess the array
}
//O(1)
public int countInRange(int a, int
PayPal Gateway not configured
PayPal Gateway not configured