Moving Average of stream Data


Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window. Implement the Solution class:
  • MovingAverage(int size) Initializes the object with the size of the window size.
  • double compute_moving_average(int val) Returns the moving average of the last size values of the stream.

Code Output