From 2ae0584d14da6ba03f589b5e212cb4b325291657 Mon Sep 17 00:00:00 2001 From: Yaniv Hollander Date: Sun, 3 Oct 2021 22:38:20 -0400 Subject: [PATCH] Update windowed_median.cpp --- probability/windowed_median.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/probability/windowed_median.cpp b/probability/windowed_median.cpp index d4af73f77..031a51213 100644 --- a/probability/windowed_median.cpp +++ b/probability/windowed_median.cpp @@ -17,9 +17,10 @@ * Time complexity: O(logN). Space complexity: O(N). N - size of window * @author [Yaniv Hollander](https://github.com/YanivHollander) */ -#include // For assert -#include // For std::list - used to manage sliding window -#include // For std::multiset - used to manage multi-value sorted sliding window values +#include // for assert +#include // for std::uint32_t +#include // for std::list - used to manage sliding window +#include // for std::multiset - used to manage multi-value sorted sliding window values /** * @namespace probability @@ -31,7 +32,7 @@ namespace probability { * @brief A class to calculate the median of a leading sliding window at the back of a stream of integer values. */ class WindowedMedian { - const int _windowSize; // Sliding window size + const std::uint32_t _windowSize; // Sliding window size std::list _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 @@ -91,7 +92,7 @@ public: * @brief Constructs a WindowedMedian object * @param windowSize Sliding window size */ - explicit WindowedMedian(int windowSize) : _windowSize(windowSize) {}; + explicit WindowedMedian(std::uint32_t windowSize) : _windowSize(windowSize) {}; /** * @brief Insert a new value to the stream