im confused about this "counter" variable. at 6:48 the median is 4 not 3.
@CodeCode-pz6oo9 ай бұрын
In the first 5 elements, the sorted window is = [2, 2, 3, 3, 4], so the median is the 3rd element (num3). And for the counter, the counter is the sum of frequency (cdf) up to the median number. For example, there are 2 of 2, 2 of 3, 1 of 4, so the sum of frequency up to 3rd element (cdf) is 2 + 2 = 4, and the median number is 3.