• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
July 07, 2022 |9.8K Views

Median of Stream of Running Integers using STL

  Share   Like
Description
Discussion

Given that integers are being read from a data stream. Find the median of all the elements read so far starting from the first integer till the last integer. This is also called the Median of Running Integers. The data stream can be any source of data, for example, a file, an array of integers, input stream etc.


Median can be defined as the element in the data set which separates the higher half of the data sample from the lower half. In other words, we can get the median element as, when the input size is odd, we take the middle element of sorted data. If the input size is even, we pick an average of middle two elements in the sorted stream.


Median of Stream of Running Integers using STL : https://www.geeksforgeeks.org/median-of-stream-of-running-integers-using-stl/