Counting sort in c++

why are we using dynamic array for calculating the frequency of elements in the provided array?

hello @Tiwary725
Nothing special , u can use static array as well.