From 35c2b0999c875c07b5029a6ca338b20b6b6bb44a Mon Sep 17 00:00:00 2001 From: Yaniv Hollander Date: Mon, 4 Oct 2021 07:53:35 -0400 Subject: [PATCH] Update windowed_median.cpp --- probability/windowed_median.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/probability/windowed_median.cpp b/probability/windowed_median.cpp index 4a09de490..70a32298f 100644 --- a/probability/windowed_median.cpp +++ b/probability/windowed_median.cpp @@ -18,7 +18,6 @@ * @author [Yaniv Hollander](https://github.com/YanivHollander) */ #include // for assert -#include // for std::uint64_t #include // for std::list - used to manage sliding window #include // for std::multiset - used to manage multi-value sorted sliding window values @@ -31,13 +30,16 @@ * @brief Probability algorithms */ namespace probability { +using Window = std::list; +using size_type = Window::size_type; + /** * @class WindowedMedian * @brief A class to calculate the median of a leading sliding window at the back of a stream of integer values. */ class WindowedMedian { - const std::uint64_t _windowSize; // Sliding window size - std::list _window; // A sliding window of values along the stream + const size_type _windowSize; // Sliding window size + Window _window; // A sliding window of values along the stream std::multiset _sortedValues; // A DS to represent a balanced multi-value binary search tree (BST) std::multiset::const_iterator _itMedian; // An iterator that points to the root of the multi-value BST @@ -96,7 +98,7 @@ public: * @brief Constructs a WindowedMedian object * @param windowSize Sliding window size */ - explicit WindowedMedian(std::uint64_t windowSize) : _windowSize(windowSize) {}; + explicit WindowedMedian(size_type windowSize) : _windowSize(windowSize) {}; /** * @brief Insert a new value to the stream