AlexandreHiroyuki / DataTome

Data analysis and filtering using time series for embedded devices (IoT). All in a single C++ library, Data Tome. Focus on the developer's experience and performance. It is the successor to the MovingAveragePlus library.
https://alexandrehiroyuki.github.io/DataTomeDocs/
MIT License
7 stars 0 forks source link

Refactor the median() method from DataTomeAnalysis to linear complexity #18

Open AlexandreHiroyuki opened 2 months ago

AlexandreHiroyuki commented 2 months ago

Currently, the algorithm sorts the array to select the median element, which consumes n * log n time.

It supposedly could be faster by implementing an algorithm like Introselect to select the median element among an unsorted array.

Other selection algorithms: https://en.wikipedia.org/wiki/Selection_algorithm