diff --git a/annotated.html b/annotated.html index e9c061d05..4b31a1c7a 100644 --- a/annotated.html +++ b/annotated.html @@ -161,64 +161,67 @@ $(document).ready(function(){initNavTree('annotated.html',''); initResizable();  CLRUCacheLRU cache class  Npostfix_expression  CStackCreates an array to be used as stack for storing values - Nquadratic_probingAn implementation of hash table using quadratic probing algorithm - CEntry - Nrange_queriesAlgorithms and Data Structures that support range queries and updates - Nheavy_light_decomposition - CHLDThe Heavy-Light Decomposition class - CSGSegment Tree, to store heavy chains - CTreeA Basic Tree, which supports binary lifting - CperSegTreeRange query here is range sum, but the code can be modified to make different queries like range max or min - CNode - NsearchFor std::vector - Nsublist_search - CNodeA Node structure representing a single link Node in a linked list - NstatisticsStatistical algorithms - Cstats_computer1 - Cstats_computer2 - NstdSTL namespace - Cis_arithmetic< uint128_t > - Cis_arithmetic< uint256_t > - Cis_integral< uint128_t > - Cis_integral< uint256_t > - Cis_unsigned< uint128_t > - Cis_unsigned< uint256_t > - Cbinary_search_treeThe Binary Search Tree class - Cbst_nodeA struct to represent a node in the Binary Search Tree - CBtree - Ccll - Ccompare - CComplexClass Complex to represent complex numbers as a field - CCycleCheck - Cdouble_linked_list - CEdge - CFenwickTree - CGraph - Chash_chainChain class with a given modulus - CItem - Clarge_number - Clinkedlist - Clist - CMinHeap - CMinHeapNode - Cmst - CNode - Cnode - CPoint - Cquery - CQueue - Cqueue - CRBtree - CSegmentIntersection - CSolution - Cstack - Cstack_linkedList - CTestCasesClass encapsulating the necessary test cases - Ctower - CTrie - CTrieNode - Cuint128_tClass for 128-bit unsigned integer - Cuint256_tClass for 256-bit unsigned integer + NprobabilityFor std::vector - needed in testing + Nwindowed_median + CWindowedMedianA class to calculate the median of a leading sliding window at the back of a stream of integer values + Nquadratic_probingAn implementation of hash table using quadratic probing algorithm + CEntry + Nrange_queriesAlgorithms and Data Structures that support range queries and updates + Nheavy_light_decomposition + CHLDThe Heavy-Light Decomposition class + CSGSegment Tree, to store heavy chains + CTreeA Basic Tree, which supports binary lifting + CperSegTreeRange query here is range sum, but the code can be modified to make different queries like range max or min + CNode + NsearchFor std::vector + Nsublist_search + CNodeA Node structure representing a single link Node in a linked list + NstatisticsStatistical algorithms + Cstats_computer1 + Cstats_computer2 + NstdSTL namespace + Cis_arithmetic< uint128_t > + Cis_arithmetic< uint256_t > + Cis_integral< uint128_t > + Cis_integral< uint256_t > + Cis_unsigned< uint128_t > + Cis_unsigned< uint256_t > + Cbinary_search_treeThe Binary Search Tree class + Cbst_nodeA struct to represent a node in the Binary Search Tree + CBtree + Ccll + Ccompare + CComplexClass Complex to represent complex numbers as a field + CCycleCheck + Cdouble_linked_list + CEdge + CFenwickTree + CGraph + Chash_chainChain class with a given modulus + CItem + Clarge_number + Clinkedlist + Clist + CMinHeap + CMinHeapNode + Cmst + Cnode + CNode + CPoint + Cquery + Cqueue + CQueue + CRBtree + CSegmentIntersection + CSolution + Cstack + Cstack_linkedList + CTestCasesClass encapsulating the necessary test cases + Ctower + CTrie + CTrieNode + Cuint128_tClass for 128-bit unsigned integer + Cuint256_tClass for 256-bit unsigned integer diff --git a/annotated_dup.js b/annotated_dup.js index 99134395f..e85d2d94f 100644 --- a/annotated_dup.js +++ b/annotated_dup.js @@ -91,6 +91,11 @@ var annotated_dup = [ "Stack", "d5/d8a/classothers_1_1postfix__expression_1_1_stack.html", "d5/d8a/classothers_1_1postfix__expression_1_1_stack" ] ] ] ] ], + [ "probability", "d4/ded/namespaceprobability.html", [ + [ "windowed_median", null, [ + [ "WindowedMedian", "df/d34/classprobability_1_1windowed__median_1_1_windowed_median.html", "df/d34/classprobability_1_1windowed__median_1_1_windowed_median" ] + ] ] + ] ], [ "quadratic_probing", "d4/dd2/namespacequadratic__probing.html", [ [ "Entry", "da/dd1/structquadratic__probing_1_1_entry.html", "da/dd1/structquadratic__probing_1_1_entry" ] ] ], @@ -137,12 +142,12 @@ var annotated_dup = [ "MinHeap", "d2/d05/class_min_heap.html", "d2/d05/class_min_heap" ], [ "MinHeapNode", "d5/d29/struct_min_heap_node.html", null ], [ "mst", "d1/d77/structmst.html", null ], - [ "Node", "db/d8b/struct_node.html", null ], [ "node", "d5/da1/structnode.html", "d5/da1/structnode" ], + [ "Node", "db/d8b/struct_node.html", null ], [ "Point", "d8/dc8/struct_point.html", "d8/dc8/struct_point" ], [ "query", "dd/d1b/structquery.html", null ], - [ "Queue", "dc/db5/struct_queue.html", null ], [ "queue", "db/da9/classqueue.html", "db/da9/classqueue" ], + [ "Queue", "dc/db5/struct_queue.html", null ], [ "RBtree", "d8/d72/class_r_btree.html", null ], [ "SegmentIntersection", "d4/db4/struct_segment_intersection.html", "d4/db4/struct_segment_intersection" ], [ "Solution", "dd/d4f/class_solution.html", null ], diff --git a/classes.html b/classes.html index 1561c1557..20382c50e 100644 --- a/classes.html +++ b/classes.html @@ -93,7 +93,7 @@ $(document).ready(function(){initNavTree('classes.html',''); initResizable(); })
Class Index
-
A | B | C | D | E | F | G | H | I | L | M | N | P | Q | R | S | T | U
+
A | B | C | D | E | F | G | H | I | L | M | N | P | Q | R | S | T | U | W
A
@@ -130,13 +130,13 @@ $(document).ready(function(){initNavTree('classes.html',''); initResizable(); })
MinHeap
MinHeapNode
mst
N
-
NCRModuloP (math::ncr_modulo_p)
NeuralNetwork (machine_learning::neural_network)
Node (data_structures::linked_list)
Node (data_structures)
Node (data_structures::tree_234)
Trie::Node (data_structures::trie_using_hashmap)
Node
node
Node (operations_on_datastructures::inorder_traversal_of_bst)
Node (others::iterative_tree_traversals)
perSegTree::Node (range_queries)
Node (search::sublist_search)
+
NCRModuloP (math::ncr_modulo_p)
NeuralNetwork (machine_learning::neural_network)
Node (data_structures::linked_list)
Node (data_structures)
Node (data_structures::tree_234)
Trie::Node (data_structures::trie_using_hashmap)
node
Node
Node (operations_on_datastructures::inorder_traversal_of_bst)
Node (others::iterative_tree_traversals)
perSegTree::Node (range_queries)
Node (search::sublist_search)
P
perSegTree (range_queries)
Point (ciphers::elliptic_curve_key_exchange)
Point (geometry::jarvis)
Point
Q
-
query
Queue
queue
Queue_Array (data_structures::queue_using_array)
+
query
queue
Queue
Queue_Array (data_structures::queue_using_array)
R
RBtree
RootedTree (graph)
@@ -149,6 +149,9 @@ $(document).ready(function(){initNavTree('classes.html',''); initResizable(); })
U
uint128_t
uint256_t
+
+
W
+
WindowedMedian (probability::windowed_median)
diff --git a/d0/d5b/windowed__median_8cpp__incl.map b/d0/d5b/windowed__median_8cpp__incl.map new file mode 100644 index 000000000..0443f4c5c --- /dev/null +++ b/d0/d5b/windowed__median_8cpp__incl.map @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/d0/d5b/windowed__median_8cpp__incl.md5 b/d0/d5b/windowed__median_8cpp__incl.md5 new file mode 100644 index 000000000..a14825e4a --- /dev/null +++ b/d0/d5b/windowed__median_8cpp__incl.md5 @@ -0,0 +1 @@ +24dc62dab115bdfc92f51646f0f7582d \ No newline at end of file diff --git a/d0/d5b/windowed__median_8cpp__incl.svg b/d0/d5b/windowed__median_8cpp__incl.svg new file mode 100644 index 000000000..4c73f38de --- /dev/null +++ b/d0/d5b/windowed__median_8cpp__incl.svg @@ -0,0 +1,113 @@ + + + + + + +probability/windowed_median.cpp + + + +Node1 + + +probability/windowed +_median.cpp + + + + + +Node2 + + +cassert + + + + + +Node1->Node2 + + + + + +Node3 + + +cstdlib + + + + + +Node1->Node3 + + + + + +Node4 + + +ctime + + + + + +Node1->Node4 + + + + + +Node5 + + +list + + + + + +Node1->Node5 + + + + + +Node6 + + +set + + + + + +Node1->Node6 + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + + + diff --git a/d1/d47/classprobability_1_1windowed__median_1_1_windowed_median-members.html b/d1/d47/classprobability_1_1windowed__median_1_1_windowed_median-members.html new file mode 100644 index 000000000..605b70197 --- /dev/null +++ b/d1/d47/classprobability_1_1windowed__median_1_1_windowed_median-members.html @@ -0,0 +1,118 @@ + + + + + + + +Algorithms_in_C++: Member List + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Algorithms_in_C++ 1.0.0 +
+
Set of algorithms implemented in C++.
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
probability::windowed_median::WindowedMedian Member List
+
+
+ +

This is the complete list of members for probability::windowed_median::WindowedMedian, including all inherited members.

+ + + + + + + + + + + +
_itMedianprobability::windowed_median::WindowedMedianprivate
_sortedValuesprobability::windowed_median::WindowedMedianprivate
_windowprobability::windowed_median::WindowedMedianprivate
_windowSizeprobability::windowed_median::WindowedMedianprivate
eraseFromSorted(int value)probability::windowed_median::WindowedMedianinlineprivate
getMedian() constprobability::windowed_median::WindowedMedianinline
getMedianNaive() constprobability::windowed_median::WindowedMedianinline
insert(int value)probability::windowed_median::WindowedMedianinline
insertToSorted(int value)probability::windowed_median::WindowedMedianinlineprivate
WindowedMedian(size_type windowSize)probability::windowed_median::WindowedMedianinlineexplicit
+
+ + + + diff --git a/d1/ded/windowed__median_8cpp.html b/d1/ded/windowed__median_8cpp.html new file mode 100644 index 000000000..422e2cf5d --- /dev/null +++ b/d1/ded/windowed__median_8cpp.html @@ -0,0 +1,325 @@ + + + + + + + +Algorithms_in_C++: probability/windowed_median.cpp File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Algorithms_in_C++ 1.0.0 +
+
Set of algorithms implemented in C++.
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
windowed_median.cpp File Reference
+
+
+ +

An implementation of a median calculation of a sliding window along a data stream. +More...

+
#include <cassert>
+#include <cstdlib>
+#include <ctime>
+#include <list>
+#include <set>
+#include <vector>
+
+Include dependency graph for windowed_median.cpp:
+
+
+
+
+
+ + + + +

+Classes

class  probability::windowed_median::WindowedMedian
 A class to calculate the median of a leading sliding window at the back of a stream of integer values. More...
 
+ + + + + + + +

+Namespaces

namespace  probability
 for std::vector - needed in testing
 
namespace  windowed_median
 Functions for the Windowed Median algorithm implementation.
 
+ + + + + +

+Typedefs

+using probability::windowed_median::Window = std::list< int >
 
+using probability::windowed_median::size_type = Window::size_type
 
+ + + + + + + +

+Functions

static void test (const std::vector< int > &vals, int windowSize)
 namespace probability More...
 
int main (int argc, const char *argv[])
 Main function. More...
 
+

Detailed Description

+

An implementation of a median calculation of a sliding window along a data stream.

+

Given a stream of integers, the algorithm calculates the median of a fixed size window at the back of the stream. The leading time complexity of this algorithm is O(log(N), and it is inspired by the known algorithm to [find median from (infinite) data stream](https://www.tutorialcup.com/interview/algorithm/find-median-from-data-stream.htm), with the proper modifications to account for the finite window size for which the median is requested

+

+Algorithm

+

The sliding window is managed by a list, which guarantees O(1) for both pushing and popping. Each new value is pushed to the window back, while a value from the front of the window is popped. In addition, the algorithm manages a multi-value binary search tree (BST), implemented by std::multiset. For each new value that is inserted into the window, it is also inserted to the BST. When a value is popped from the window, it is also erased from the BST. Both insertion and erasion to/from the BST are O(logN) in time, with N the size of the window. Finally, the algorithm keeps a pointer to the root of the BST, and updates its position whenever values are inserted or erased to/from BST. The root of the tree is the median! Hence, median retrieval is always O(1)

+

Time complexity: O(logN). Space complexity: O(N). N - size of window

Author
Yaniv Hollander
+

Function Documentation

+ +

◆ main()

+ +
+
+ + + + + + + + + + + + + + + + + + +
int main (int argc,
const char * argv[] 
)
+
+ +

Main function.

+
Parameters
+ + + +
argccommand line argument count (ignored)
argvcommand line array of arguments (ignored)
+
+
+
Returns
0 on exit
+

A few fixed test cases

+

Array of sorted values; odd window size

+

Array of sorted values - decreasing; odd window size

+

Even window size

+

Array with repeating values

+

Array with same values except one

+

Array that includes repeating values including negatives

+

Array with large values - sum of few pairs exceeds MAX_INT. Window size is even - testing calculation of average median between two middle values

+

Random test cases

+

Array size in the range [5, 20]

+

Window size in the range [3, 10]

+

Random array values (positive/negative)

+

Testing randomized test

+
197 {
+
198
+
199 /// A few fixed test cases
+
200 test({1, 2, 3, 4, 5, 6, 7, 8, 9}, 3); /// Array of sorted values; odd window size
+
201 test({9, 8, 7, 6, 5, 4, 3, 2, 1}, 3); /// Array of sorted values - decreasing; odd window size
+
202 test({9, 8, 7, 6, 5, 4, 5, 6}, 4); /// Even window size
+
203 test({3, 3, 3, 3, 3, 3, 3, 3, 3}, 3); /// Array with repeating values
+
204 test({3, 3, 3, 3, 7, 3, 3, 3, 3}, 3); /// Array with same values except one
+
205 test({4, 3, 3, -5, -5, 1, 3, 4, 5}, 5); /// Array that includes repeating values including negatives
+
206
+
207 /// Array with large values - sum of few pairs exceeds MAX_INT. Window size is even - testing calculation of
+
208 /// average median between two middle values
+
209 test({470211272, 101027544, 1457850878, 1458777923, 2007237709, 823564440,
+
210 1115438165, 1784484492, 74243042, 114807987}, 6);
+
211
+
212 /// Random test cases
+
213 std::srand(static_cast<unsigned int>(std::time(nullptr)));
+
214 std::vector<int> vals;
+
215 for (int i = 8; i < 100; i++) {
+
216 const auto n = 1 + std::rand() / ((RAND_MAX + 5u) / 20); /// Array size in the range [5, 20]
+
217 auto windowSize = 1 + std::rand() / ((RAND_MAX + 3u) / 10); /// Window size in the range [3, 10]
+
218 vals.clear();
+
219 vals.reserve(n);
+
220 for (int i = 0; i < n; i++) {
+
221 vals.push_back(rand() - RAND_MAX); /// Random array values (positive/negative)
+
222 }
+
223 test(vals, windowSize); /// Testing randomized test
+
224 }
+
225 return 0;
+
226}
+
T clear(T... args)
+
T push_back(T... args)
+
T rand(T... args)
+
T reserve(T... args)
+
T srand(T... args)
+
T time(T... args)
+ +
static void test(const std::vector< int > &vals, int windowSize)
namespace probability
Definition: windowed_median.cpp:181
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+ +

◆ test()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
static void test (const std::vector< int > & vals,
int windowSize 
)
+
+static
+
+ +

namespace probability

+

Self-test implementations

Parameters
+ + + +
valsStream of values
windowSizeSize of sliding window
+
+
+

Comparing medians: efficient function vs. Naive one

+
181 {
+
182 probability::windowed_median::WindowedMedian windowedMedian(windowSize);
+
183 for (const auto val : vals) {
+
184 windowedMedian.insert(val);
+
185
+
186 /// Comparing medians: efficient function vs. Naive one
+
187 assert(windowedMedian.getMedian() == windowedMedian.getMedianNaive());
+
188 }
+
189}
+
A class to calculate the median of a leading sliding window at the back of a stream of integer values...
Definition: windowed_median.cpp:56
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+
+
+ + + + diff --git a/d1/ded/windowed__median_8cpp.js b/d1/ded/windowed__median_8cpp.js new file mode 100644 index 000000000..e3d1c1be0 --- /dev/null +++ b/d1/ded/windowed__median_8cpp.js @@ -0,0 +1,6 @@ +var windowed__median_8cpp = +[ + [ "probability::windowed_median::WindowedMedian", "df/d34/classprobability_1_1windowed__median_1_1_windowed_median.html", "df/d34/classprobability_1_1windowed__median_1_1_windowed_median" ], + [ "main", "d1/ded/windowed__median_8cpp.html#ac0f2228420376f4db7e1274f2b41667c", null ], + [ "test", "d1/ded/windowed__median_8cpp.html#a6dc652a36ea42ba262c4e4236e3e6601", null ] +]; \ No newline at end of file diff --git a/d1/ded/windowed__median_8cpp_a6dc652a36ea42ba262c4e4236e3e6601_cgraph.map b/d1/ded/windowed__median_8cpp_a6dc652a36ea42ba262c4e4236e3e6601_cgraph.map new file mode 100644 index 000000000..c6d371edc --- /dev/null +++ b/d1/ded/windowed__median_8cpp_a6dc652a36ea42ba262c4e4236e3e6601_cgraph.map @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/d1/ded/windowed__median_8cpp_a6dc652a36ea42ba262c4e4236e3e6601_cgraph.md5 b/d1/ded/windowed__median_8cpp_a6dc652a36ea42ba262c4e4236e3e6601_cgraph.md5 new file mode 100644 index 000000000..5f4b24530 --- /dev/null +++ b/d1/ded/windowed__median_8cpp_a6dc652a36ea42ba262c4e4236e3e6601_cgraph.md5 @@ -0,0 +1 @@ +af3ecd3d6ea1f430112ad540bab9e020 \ No newline at end of file diff --git a/d1/ded/windowed__median_8cpp_a6dc652a36ea42ba262c4e4236e3e6601_cgraph.svg b/d1/ded/windowed__median_8cpp_a6dc652a36ea42ba262c4e4236e3e6601_cgraph.svg new file mode 100644 index 000000000..27945013c --- /dev/null +++ b/d1/ded/windowed__median_8cpp_a6dc652a36ea42ba262c4e4236e3e6601_cgraph.svg @@ -0,0 +1,182 @@ + + + + + + +test + + + +Node1 + + +test + + + + + +Node2 + + +probability::windowed +_median::WindowedMedian +::getMedian + + + + + +Node1->Node2 + + + + + +Node3 + + +probability::windowed +_median::WindowedMedian +::getMedianNaive + + + + + +Node1->Node3 + + + + + +Node5 + + +probability::windowed +_median::WindowedMedian +::insert + + + + + +Node1->Node5 + + + + + +Node4 + + +std::list::sort + + + + + +Node3->Node4 + + + + + +Node6 + + +probability::windowed +_median::WindowedMedian +::eraseFromSorted + + + + + +Node5->Node6 + + + + + +Node7 + + +std::list::front + + + + + +Node5->Node7 + + + + + +Node8 + + +probability::windowed +_median::WindowedMedian +::insertToSorted + + + + + +Node5->Node8 + + + + + +Node9 + + +std::list::pop_front + + + + + +Node5->Node9 + + + + + +Node10 + + +std::list::push_back + + + + + +Node5->Node10 + + + + + +Node11 + + +std::list::size + + + + + +Node5->Node11 + + + + + diff --git a/d1/ded/windowed__median_8cpp_ac0f2228420376f4db7e1274f2b41667c_cgraph.map b/d1/ded/windowed__median_8cpp_ac0f2228420376f4db7e1274f2b41667c_cgraph.map new file mode 100644 index 000000000..fd2a2fb06 --- /dev/null +++ b/d1/ded/windowed__median_8cpp_ac0f2228420376f4db7e1274f2b41667c_cgraph.map @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/d1/ded/windowed__median_8cpp_ac0f2228420376f4db7e1274f2b41667c_cgraph.md5 b/d1/ded/windowed__median_8cpp_ac0f2228420376f4db7e1274f2b41667c_cgraph.md5 new file mode 100644 index 000000000..622913426 --- /dev/null +++ b/d1/ded/windowed__median_8cpp_ac0f2228420376f4db7e1274f2b41667c_cgraph.md5 @@ -0,0 +1 @@ +3a15537f7782af1ae7db25b318481ec4 \ No newline at end of file diff --git a/d1/ded/windowed__median_8cpp_ac0f2228420376f4db7e1274f2b41667c_cgraph.svg b/d1/ded/windowed__median_8cpp_ac0f2228420376f4db7e1274f2b41667c_cgraph.svg new file mode 100644 index 000000000..10c55b11f --- /dev/null +++ b/d1/ded/windowed__median_8cpp_ac0f2228420376f4db7e1274f2b41667c_cgraph.svg @@ -0,0 +1,375 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +main + + + +Node1 + + +main + + + + + +Node2 + + +std::vector::clear + + + + + +Node1->Node2 + + + + + +Node3 + + +std::vector::push_back + + + + + +Node1->Node3 + + + + + +Node4 + + +std::rand + + + + + +Node1->Node4 + + + + + +Node5 + + +std::vector::reserve + + + + + +Node1->Node5 + + + + + +Node6 + + +std::srand + + + + + +Node1->Node6 + + + + + +Node7 + + +test + + + + + +Node1->Node7 + + + + + +Node18 + + +std::time + + + + + +Node1->Node18 + + + + + +Node8 + + +probability::windowed +_median::WindowedMedian +::getMedian + + + + + +Node7->Node8 + + + + + +Node9 + + +probability::windowed +_median::WindowedMedian +::getMedianNaive + + + + + +Node7->Node9 + + + + + +Node11 + + +probability::windowed +_median::WindowedMedian +::insert + + + + + +Node7->Node11 + + + + + +Node10 + + +std::list::sort + + + + + +Node9->Node10 + + + + + +Node12 + + +probability::windowed +_median::WindowedMedian +::eraseFromSorted + + + + + +Node11->Node12 + + + + + +Node13 + + +std::list::front + + + + + +Node11->Node13 + + + + + +Node14 + + +probability::windowed +_median::WindowedMedian +::insertToSorted + + + + + +Node11->Node14 + + + + + +Node15 + + +std::list::pop_front + + + + + +Node11->Node15 + + + + + +Node16 + + +std::list::push_back + + + + + +Node11->Node16 + + + + + +Node17 + + +std::list::size + + + + + +Node11->Node17 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/d1/ded/windowed__median_8cpp_ac0f2228420376f4db7e1274f2b41667c_cgraph_org.svg b/d1/ded/windowed__median_8cpp_ac0f2228420376f4db7e1274f2b41667c_cgraph_org.svg new file mode 100644 index 000000000..e8eabd5c2 --- /dev/null +++ b/d1/ded/windowed__median_8cpp_ac0f2228420376f4db7e1274f2b41667c_cgraph_org.svg @@ -0,0 +1,287 @@ + + + + + + +main + + + +Node1 + + +main + + + + + +Node2 + + +std::vector::clear + + + + + +Node1->Node2 + + + + + +Node3 + + +std::vector::push_back + + + + + +Node1->Node3 + + + + + +Node4 + + +std::rand + + + + + +Node1->Node4 + + + + + +Node5 + + +std::vector::reserve + + + + + +Node1->Node5 + + + + + +Node6 + + +std::srand + + + + + +Node1->Node6 + + + + + +Node7 + + +test + + + + + +Node1->Node7 + + + + + +Node18 + + +std::time + + + + + +Node1->Node18 + + + + + +Node8 + + +probability::windowed +_median::WindowedMedian +::getMedian + + + + + +Node7->Node8 + + + + + +Node9 + + +probability::windowed +_median::WindowedMedian +::getMedianNaive + + + + + +Node7->Node9 + + + + + +Node11 + + +probability::windowed +_median::WindowedMedian +::insert + + + + + +Node7->Node11 + + + + + +Node10 + + +std::list::sort + + + + + +Node9->Node10 + + + + + +Node12 + + +probability::windowed +_median::WindowedMedian +::eraseFromSorted + + + + + +Node11->Node12 + + + + + +Node13 + + +std::list::front + + + + + +Node11->Node13 + + + + + +Node14 + + +probability::windowed +_median::WindowedMedian +::insertToSorted + + + + + +Node11->Node14 + + + + + +Node15 + + +std::list::pop_front + + + + + +Node11->Node15 + + + + + +Node16 + + +std::list::push_back + + + + + +Node11->Node16 + + + + + +Node17 + + +std::list::size + + + + + +Node11->Node17 + + + + + diff --git a/d2/d26/count__inversions_8cpp.html b/d2/d26/count__inversions_8cpp.html index 92843f501..a27e31079 100644 --- a/d2/d26/count__inversions_8cpp.html +++ b/d2/d26/count__inversions_8cpp.html @@ -151,7 +151,7 @@ Functions

two elements a[i] and a[j] form an inversion if a[i] > a[j] and i < j

Time Complexity --> O(n.log n)

Space Complexity --> O(n) ; additional array temp[1..n]

-

+

Algorithm

  1. The idea is similar to merge sort, divide the array into two equal or almost equal halves in each step until the base case is reached.
  2. diff --git a/d2/d92/classprobability_1_1windowed__median_1_1_windowed_median__coll__graph.map b/d2/d92/classprobability_1_1windowed__median_1_1_windowed_median__coll__graph.map new file mode 100644 index 000000000..70adeda48 --- /dev/null +++ b/d2/d92/classprobability_1_1windowed__median_1_1_windowed_median__coll__graph.map @@ -0,0 +1,4 @@ + + + + diff --git a/d2/d92/classprobability_1_1windowed__median_1_1_windowed_median__coll__graph.md5 b/d2/d92/classprobability_1_1windowed__median_1_1_windowed_median__coll__graph.md5 new file mode 100644 index 000000000..66d0d9df7 --- /dev/null +++ b/d2/d92/classprobability_1_1windowed__median_1_1_windowed_median__coll__graph.md5 @@ -0,0 +1 @@ +5bbd0ad9b78a72a32d89cfb7d5aa3f03 \ No newline at end of file diff --git a/d2/d92/classprobability_1_1windowed__median_1_1_windowed_median__coll__graph.svg b/d2/d92/classprobability_1_1windowed__median_1_1_windowed_median__coll__graph.svg new file mode 100644 index 000000000..243345df8 --- /dev/null +++ b/d2/d92/classprobability_1_1windowed__median_1_1_windowed_median__coll__graph.svg @@ -0,0 +1,39 @@ + + + + + + +probability::windowed_median::WindowedMedian + + + +Node1 + + +probability::windowed +_median::WindowedMedian + + + + + +Node2 + + +std::list< int > + + + + + +Node2->Node1 + + + _window + + + diff --git a/d3/df9/recursive__bubble__sort_8cpp.html b/d3/df9/recursive__bubble__sort_8cpp.html index 692decf99..aad58ffd2 100644 --- a/d3/df9/recursive__bubble__sort_8cpp.html +++ b/d3/df9/recursive__bubble__sort_8cpp.html @@ -135,7 +135,7 @@ Functions
    Author
    Aditya Prakash

    The working principle of the Bubble sort algorithm.

    Bubble sort is a simple sorting algorithm used to rearrange a set of ascending or descending order elements. Bubble sort gets its name from the fact that data "bubbles" to the top of the dataset.

    -

    +

    Algorithm

    What is Swap?

    Swapping two numbers means that we interchange their values. Often, an additional variable is required for this operation. This is further illustrated in the following:

    diff --git a/d4/d9f/selection__sort__recursive_8cpp.html b/d4/d9f/selection__sort__recursive_8cpp.html index b734a1992..69ee52e4e 100644 --- a/d4/d9f/selection__sort__recursive_8cpp.html +++ b/d4/d9f/selection__sort__recursive_8cpp.html @@ -139,7 +139,7 @@ Functions

    Detailed Description

    Implementation of the Selection sort implementation using recursion.

    The selection sort algorithm divides the input list into two parts: a sorted sublist of items which is built up from left to right at the front (left) of the list, and a sublist of the remaining unsorted items that occupy the rest of the list. Initially, the sorted sublist is empty, and the unsorted sublist is the entire input list. The algorithm proceeds by finding the smallest (or largest, depending on the sorting order) element in the unsorted sublist, exchanging (swapping) it with the leftmost unsorted element (putting it in sorted order), and moving the sublist boundaries one element to the right.

    -

    +

    Implementation

    FindMinIndex This function finds the minimum element of the array(list) recursively by simply comparing the minimum element of array reduced size by 1 and compares it to the last element of the array to find the minimum of the whole array.

    SelectionSortRecursive Just like selection sort, it divides the list into two parts (i.e.: sorted and unsorted) and finds the minimum of the unsorted array. By calling the FindMinIndex function, it swaps the minimum element with the first element of the list, and then solves recursively for the remaining unsorted list.

    Author
    Tushar Khanduri
    diff --git a/d4/ded/namespaceprobability.html b/d4/ded/namespaceprobability.html new file mode 100644 index 000000000..7dcea5883 --- /dev/null +++ b/d4/ded/namespaceprobability.html @@ -0,0 +1,113 @@ + + + + + + + +Algorithms_in_C++: probability Namespace Reference + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Algorithms_in_C++ 1.0.0 +
    +
    Set of algorithms implemented in C++.
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    probability Namespace Reference
    +
    +
    + +

    for std::vector - needed in testing +More...

    +

    Detailed Description

    +

    for std::vector - needed in testing

    +

    for assert for std::rand - needed in testing for std::time - needed in testing for std::list - used to manage sliding window for std::multiset - used to manage multi-value sorted sliding window values

    +

    Probability algorithms

    +
    +
    + + + + diff --git a/d4/ded/namespaceprobability.js b/d4/ded/namespaceprobability.js new file mode 100644 index 000000000..10ff6cf7d --- /dev/null +++ b/d4/ded/namespaceprobability.js @@ -0,0 +1,6 @@ +var namespaceprobability = +[ + [ "windowed_median", null, [ + [ "WindowedMedian", "df/d34/classprobability_1_1windowed__median_1_1_windowed_median.html", "df/d34/classprobability_1_1windowed__median_1_1_windowed_median" ] + ] ] +]; \ No newline at end of file diff --git a/d5/d45/sublist__search_8cpp.html b/d5/d45/sublist__search_8cpp.html index d4d314da3..2d629b439 100644 --- a/d5/d45/sublist__search_8cpp.html +++ b/d5/d45/sublist__search_8cpp.html @@ -148,14 +148,14 @@ Functions

    Detailed Description

    Implementation of the Sublist Search Algorithm

    -

    +

    Algorithm

    • Sublist search is used to detect a presence of one list in another list.
    • Suppose we have a single-node list (let's say the first list), and we want to ensure that the list is present in another list (let's say the second list), then we can perform the sublist search to find it.
    • For instance, the first list contains these elements: 23 -> 30 -> 41, and the second list contains these elements: 10 -> 15 -> 23 -> 30 -> 41 -> 49. At a glance, we see that the first list presents in the second list.
    -

    +

    Working

    • The sublist search algorithm works by comparing the first element of the first list with the first element of the second list.
    • diff --git a/d5/d88/md__d_i_r_e_c_t_o_r_y.html b/d5/d88/md__d_i_r_e_c_t_o_r_y.html index 0d46a9968..a4939c32b 100644 --- a/d5/d88/md__d_i_r_e_c_t_o_r_y.html +++ b/d5/d88/md__d_i_r_e_c_t_o_r_y.html @@ -397,6 +397,7 @@ Probability
    • Bayes Theorem
    • Binomial Dist
    • Poisson Dist
    • +
    • Windowed Median

    Range Queries

    diff --git a/d5/ddb/bogo__sort_8cpp.html b/d5/ddb/bogo__sort_8cpp.html index a632165e0..5fca0b893 100644 --- a/d5/ddb/bogo__sort_8cpp.html +++ b/d5/ddb/bogo__sort_8cpp.html @@ -135,7 +135,7 @@ Functions

    Detailed Description

    Implementation of Bogosort algorithm

    In computer science, bogosort (also known as permutation sort, stupid sort, slowsort, shotgun sort, random sort, monkey sort, bobosort or shuffle sort) is a highly inefficient sorting algorithm based on the generate and test paradigm. Two versions of this algorithm exist: a deterministic version that enumerates all permutations until it hits a sorted one, and a randomized version that randomly permutes its input.Randomized version is implemented here.

    -

    +

    Algorithm

    Shuffle the array untill array is sorted.

    Author
    Deep Raval
    diff --git a/d6/db0/binomial__dist_8cpp.html b/d6/db0/binomial__dist_8cpp.html index 6cc6a5214..c59d52a9b 100644 --- a/d6/db0/binomial__dist_8cpp.html +++ b/d6/db0/binomial__dist_8cpp.html @@ -209,13 +209,14 @@ Functions

    calculates the probability of a result within a range (inclusive, inclusive)

    Returns
    \(\displaystyle \left.P(n,p)\right|_{x_0}^{x_1} = \sum_{i=x_0}^{x_1} P(i) =\sum_{i=x_0}^{x_1} {n\choose i} p^i (1-p)^{n-i}\)
    75 {
    -
    76 double probability = 0;
    +
    76 double probability = 0;
    77 for (int i = lower_bound; i <= upper_bound; i++) {
    -
    78 probability += nCr(n, i) * std::pow(p, i) * std::pow(1 - p, n - i);
    +
    78 probability += nCr(n, i) * std::pow(p, i) * std::pow(1 - p, n - i);
    79 }
    -
    80 return probability;
    +
    80 return probability;
    81}
    double nCr(double n, double r)
    Definition: binomial_dist.cpp:47
    +
    for std::vector - needed in testing
    T pow(T... args)
    T upper_bound(T... args)
    diff --git a/d9/d24/poisson__dist_8cpp.html b/d9/d24/poisson__dist_8cpp.html index 38721d964..f291f1936 100644 --- a/d9/d24/poisson__dist_8cpp.html +++ b/d9/d24/poisson__dist_8cpp.html @@ -268,12 +268,13 @@ Here is the call graph for this function:
    \[P = \sum_i p(\mu,i)\]

    54 {
    -
    55 double probability = 0;
    +
    55 double probability = 0;
    56 for (int i = lower; i <= upper; i++) {
    -
    57 probability += poisson_x_successes(expected, i);
    +
    57 probability += poisson_x_successes(expected, i);
    58 }
    -
    59 return probability;
    +
    59 return probability;
    60}
    +
    for std::vector - needed in testing
    Here is the call graph for this function:
    diff --git a/dd/d21/namespacewindowed__median.html b/dd/d21/namespacewindowed__median.html new file mode 100644 index 000000000..48516dd10 --- /dev/null +++ b/dd/d21/namespacewindowed__median.html @@ -0,0 +1,111 @@ + + + + + + + +Algorithms_in_C++: windowed_median Namespace Reference + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Algorithms_in_C++ 1.0.0 +
    +
    Set of algorithms implemented in C++.
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    windowed_median Namespace Reference
    +
    +
    + +

    Functions for the Windowed Median algorithm implementation. +More...

    +

    Detailed Description

    +

    Functions for the Windowed Median algorithm implementation.

    +
    +
    + + + + diff --git a/df/d34/classprobability_1_1windowed__median_1_1_windowed_median.html b/df/d34/classprobability_1_1windowed__median_1_1_windowed_median.html new file mode 100644 index 000000000..14c856473 --- /dev/null +++ b/df/d34/classprobability_1_1windowed__median_1_1_windowed_median.html @@ -0,0 +1,521 @@ + + + + + + + +Algorithms_in_C++: probability::windowed_median::WindowedMedian Class Reference + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Algorithms_in_C++ 1.0.0 +
    +
    Set of algorithms implemented in C++.
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    probability::windowed_median::WindowedMedian Class Reference
    +
    +
    + +

    A class to calculate the median of a leading sliding window at the back of a stream of integer values. + More...

    +
    +Collaboration diagram for probability::windowed_median::WindowedMedian:
    +
    +
    +
    +
    [legend]
    + + + + + + + + + + + + + + +

    +Public Member Functions

     WindowedMedian (size_type windowSize)
     Constructs a WindowedMedian object. More...
     
    void insert (int value)
     Insert a new value to the stream. More...
     
    float getMedian () const
     Gets the median of the values in the sliding window. More...
     
    float getMedianNaive () const
     A naive and inefficient method to obtain the median of the sliding window. Used for testing! More...
     
    + + + + + + + +

    +Private Member Functions

    void insertToSorted (int value)
     Inserts a value to a sorted multi-value BST. More...
     
    void eraseFromSorted (int value)
     Erases a value from a sorted multi-value BST. More...
     
    + + + + + + + + + + + +

    +Private Attributes

    +const size_type _windowSize
     sliding window size
     
    +Window _window
     a sliding window of values along the stream
     
    std::multiset< int > _sortedValues
     
    std::multiset< int >::const_iterator _itMedian
     
    +

    Detailed Description

    +

    A class to calculate the median of a leading sliding window at the back of a stream of integer values.

    +

    Constructor & Destructor Documentation

    + +

    ◆ WindowedMedian()

    + +
    +
    + + + + + +
    + + + + + + + + +
    probability::windowed_median::WindowedMedian::WindowedMedian (size_type windowSize)
    +
    +inlineexplicit
    +
    + +

    Constructs a WindowedMedian object.

    +
    Parameters
    + + +
    windowSizeSliding window size
    +
    +
    +
    122: _windowSize(windowSize){};
    +
    const size_type _windowSize
    sliding window size
    Definition: windowed_median.cpp:57
    +
    +
    +
    +

    Member Function Documentation

    + +

    ◆ eraseFromSorted()

    + +
    +
    + + + + + +
    + + + + + + + + +
    void probability::windowed_median::WindowedMedian::eraseFromSorted (int value)
    +
    +inlineprivate
    +
    + +

    Erases a value from a sorted multi-value BST.

    +
    Parameters
    + + +
    valueValue to insert
    +
    +
    +

    If the erased value is on the left branch or the median itself and the number of elements is even, the new median will be the right child of the current one

    +

    O(1) - traversing one step to the right child

    +

    However, if the erased value is on the right branch or the median itself, and the number of elements is odd, the new median will be the left child of the current one

    +

    Find the (first) position of the value we want to erase, and erase it

    +
    95 {
    +
    96 const auto sz = _sortedValues.size();
    +
    97
    +
    98 /// If the erased value is on the left branch or the median itself and
    +
    99 /// the number of elements is even, the new median will be the right
    +
    100 /// child of the current one
    +
    101 if (value <= *_itMedian && sz % 2 == 0) {
    +
    102 ++_itMedian; /// O(1) - traversing one step to the right child
    +
    103 }
    +
    104
    +
    105 /// However, if the erased value is on the right branch or the median
    +
    106 /// itself, and the number of elements is odd, the new median will be the
    +
    107 /// left child of the current one
    +
    108 else if (value >= *_itMedian && sz % 2 != 0) {
    +
    109 --_itMedian; // O(1) - traversing one step to the left child
    +
    110 }
    +
    111
    +
    112 /// Find the (first) position of the value we want to erase, and erase it
    +
    113 const auto it = _sortedValues.find(value); // O(logN)
    +
    114 _sortedValues.erase(it); // O(logN)
    +
    115 }
    +
    std::multiset< int >::const_iterator _itMedian
    Definition: windowed_median.cpp:62
    +
    std::multiset< int > _sortedValues
    Definition: windowed_median.cpp:59
    +
    +
    +
    + +

    ◆ getMedian()

    + +
    +
    + + + + + +
    + + + + + + + +
    float probability::windowed_median::WindowedMedian::getMedian () const
    +
    +inline
    +
    + +

    Gets the median of the values in the sliding window.

    +
    Returns
    Median of sliding window. For even window size return the average between the two values in the middle
    +

    O(1)

    +
    147 {
    +
    148 if (_sortedValues.size() % 2 != 0) {
    +
    149 return *_itMedian; // O(1)
    +
    150 }
    +
    151 return 0.5f * *_itMedian + 0.5f * *next(_itMedian); /// O(1)
    +
    152 }
    +
    T next(T... args)
    +
    +
    +
    + +

    ◆ getMedianNaive()

    + +
    +
    + + + + + +
    + + + + + + + +
    float probability::windowed_median::WindowedMedian::getMedianNaive () const
    +
    +inline
    +
    + +

    A naive and inefficient method to obtain the median of the sliding window. Used for testing!

    +
    Returns
    Median of sliding window. For even window size return the average between the two values in the middle
    +

    Sort window - O(NlogN)

    +

    Find value in the middle - O(N)

    +

    O(N)

    +
    160 {
    +
    161 auto window = _window;
    +
    162 window.sort(); /// Sort window - O(NlogN)
    +
    163 auto median =
    +
    164 *next(window.begin(),
    +
    165 window.size() / 2); /// Find value in the middle - O(N)
    +
    166 if (window.size() % 2 != 0) {
    +
    167 return median;
    +
    168 }
    +
    169 return 0.5f * median +
    +
    170 0.5f * *next(window.begin(), window.size() / 2 - 1); /// O(N)
    +
    171 }
    +
    Window _window
    a sliding window of values along the stream
    Definition: windowed_median.cpp:58
    +
    T sort(T... args)
    +
    +Here is the call graph for this function:
    +
    +
    +
    +
    + +
    +
    + +

    ◆ insert()

    + +
    +
    + + + + + +
    + + + + + + + + +
    void probability::windowed_median::WindowedMedian::insert (int value)
    +
    +inline
    +
    + +

    Insert a new value to the stream.

    +
    Parameters
    + + +
    valueNew value to insert
    +
    +
    +

    Push new value to the back of the sliding window - O(1)

    +

    If exceeding size of window, pop from its left side

    +

    Erase from the multi-value BST the window left side value

    +

    Pop the left side value from the window - O(1)

    +
    128 {
    +
    129
    +
    130 /// Push new value to the back of the sliding window - O(1)
    +
    131 _window.push_back(value);
    +
    132 insertToSorted(value); // Insert value to the multi-value BST - O(logN)
    +
    133 if (_window.size() > _windowSize) { /// If exceeding size of window, pop
    +
    134 /// from its left side
    +
    135 eraseFromSorted(_window.front()); /// Erase from the multi-value BST
    +
    136 /// the window left side value
    +
    137 _window
    +
    138 .pop_front(); /// Pop the left side value from the window - O(1)
    +
    139 }
    +
    140 }
    +
    void insertToSorted(int value)
    Inserts a value to a sorted multi-value BST.
    Definition: windowed_median.cpp:69
    +
    void eraseFromSorted(int value)
    Erases a value from a sorted multi-value BST.
    Definition: windowed_median.cpp:95
    +
    T front(T... args)
    +
    T pop_front(T... args)
    +
    T push_back(T... args)
    +
    T size(T... args)
    +
    +Here is the call graph for this function:
    +
    +
    +
    +
    + +
    +
    + +

    ◆ insertToSorted()

    + +
    +
    + + + + + +
    + + + + + + + + +
    void probability::windowed_median::WindowedMedian::insertToSorted (int value)
    +
    +inlineprivate
    +
    + +

    Inserts a value to a sorted multi-value BST.

    +
    Parameters
    + + +
    valueValue to insert
    +
    +
    +

    Insert value to BST - O(logN)

    +

    For the first value, set median iterator to BST root

    +

    If new value goes to left tree branch, and number of elements is even, the new median in the balanced tree is the left child of the median before the insertion

    +

    However, if the new value goes to the right branch, the previous median's right child is the new median in the balanced tree

    +

    O(1) - traversing one step to the right child

    +
    69 {
    +
    70 _sortedValues.insert(value); /// Insert value to BST - O(logN)
    +
    71 const auto sz = _sortedValues.size();
    +
    72 if (sz == 1) { /// For the first value, set median iterator to BST root
    +
    73 _itMedian = _sortedValues.begin();
    +
    74 return;
    +
    75 }
    +
    76
    +
    77 /// If new value goes to left tree branch, and number of elements is
    +
    78 /// even, the new median in the balanced tree is the left child of the
    +
    79 /// median before the insertion
    +
    80 if (value < *_itMedian && sz % 2 == 0) {
    +
    81 --_itMedian; // O(1) - traversing one step to the left child
    +
    82 }
    +
    83
    +
    84 /// However, if the new value goes to the right branch, the previous
    +
    85 /// median's right child is the new median in the balanced tree
    +
    86 else if (value >= *_itMedian && sz % 2 != 0) {
    +
    87 ++_itMedian; /// O(1) - traversing one step to the right child
    +
    88 }
    +
    89 }
    +
    +
    +
    +

    Member Data Documentation

    + +

    ◆ _itMedian

    + +
    +
    + + + + + +
    + + + + +
    std::multiset<int>::const_iterator probability::windowed_median::WindowedMedian::_itMedian
    +
    +private
    +
    +

    an iterator that points to the root of the multi-value BST

    + +
    +
    + +

    ◆ _sortedValues

    + +
    +
    + + + + + +
    + + + + +
    std::multiset<int> probability::windowed_median::WindowedMedian::_sortedValues
    +
    +private
    +
    +

    a DS to represent a balanced multi-value binary search tree (BST)

    + +
    +
    +
    The documentation for this class was generated from the following file: +
    +
    + + + + diff --git a/df/d34/classprobability_1_1windowed__median_1_1_windowed_median.js b/df/d34/classprobability_1_1windowed__median_1_1_windowed_median.js new file mode 100644 index 000000000..8d9da469f --- /dev/null +++ b/df/d34/classprobability_1_1windowed__median_1_1_windowed_median.js @@ -0,0 +1,13 @@ +var classprobability_1_1windowed__median_1_1_windowed_median = +[ + [ "WindowedMedian", "df/d34/classprobability_1_1windowed__median_1_1_windowed_median.html#aac676369661d15a3eb782c0fee77d45d", null ], + [ "eraseFromSorted", "df/d34/classprobability_1_1windowed__median_1_1_windowed_median.html#af544e271ea19a6fd69a6b3ed6816453e", null ], + [ "getMedian", "df/d34/classprobability_1_1windowed__median_1_1_windowed_median.html#a938cafbdf70dc01e86e9bb12d29ec65d", null ], + [ "getMedianNaive", "df/d34/classprobability_1_1windowed__median_1_1_windowed_median.html#a61804988fcb1a6caf640f8291979aaa6", null ], + [ "insert", "df/d34/classprobability_1_1windowed__median_1_1_windowed_median.html#a6b52b7851750f28d53508e63c52a69f7", null ], + [ "insertToSorted", "df/d34/classprobability_1_1windowed__median_1_1_windowed_median.html#a3a7f57679e9cd6c9f042dfd0612b2b24", null ], + [ "_itMedian", "df/d34/classprobability_1_1windowed__median_1_1_windowed_median.html#a55ae3543a76045dffcb5ec7904a32a20", null ], + [ "_sortedValues", "df/d34/classprobability_1_1windowed__median_1_1_windowed_median.html#aacd76f078632faee1a8788d031e6c2de", null ], + [ "_window", "df/d34/classprobability_1_1windowed__median_1_1_windowed_median.html#a825a7aaef844c9f743a27b268e8569b2", null ], + [ "_windowSize", "df/d34/classprobability_1_1windowed__median_1_1_windowed_median.html#aafda847b152684578dab891e5268d750", null ] +]; \ No newline at end of file diff --git a/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a61804988fcb1a6caf640f8291979aaa6_cgraph.map b/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a61804988fcb1a6caf640f8291979aaa6_cgraph.map new file mode 100644 index 000000000..fcd652e76 --- /dev/null +++ b/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a61804988fcb1a6caf640f8291979aaa6_cgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a61804988fcb1a6caf640f8291979aaa6_cgraph.md5 b/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a61804988fcb1a6caf640f8291979aaa6_cgraph.md5 new file mode 100644 index 000000000..7632d0fd5 --- /dev/null +++ b/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a61804988fcb1a6caf640f8291979aaa6_cgraph.md5 @@ -0,0 +1 @@ +19f277ade2370421aaae477775231f5b \ No newline at end of file diff --git a/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a61804988fcb1a6caf640f8291979aaa6_cgraph.svg b/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a61804988fcb1a6caf640f8291979aaa6_cgraph.svg new file mode 100644 index 000000000..743edd69f --- /dev/null +++ b/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a61804988fcb1a6caf640f8291979aaa6_cgraph.svg @@ -0,0 +1,39 @@ + + + + + + +probability::windowed_median::WindowedMedian::getMedianNaive + + + +Node1 + + +probability::windowed +_median::WindowedMedian +::getMedianNaive + + + + + +Node2 + + +std::list::sort + + + + + +Node1->Node2 + + + + + diff --git a/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a6b52b7851750f28d53508e63c52a69f7_cgraph.map b/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a6b52b7851750f28d53508e63c52a69f7_cgraph.map new file mode 100644 index 000000000..67dfb0fed --- /dev/null +++ b/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a6b52b7851750f28d53508e63c52a69f7_cgraph.map @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a6b52b7851750f28d53508e63c52a69f7_cgraph.md5 b/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a6b52b7851750f28d53508e63c52a69f7_cgraph.md5 new file mode 100644 index 000000000..b59dd721e --- /dev/null +++ b/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a6b52b7851750f28d53508e63c52a69f7_cgraph.md5 @@ -0,0 +1 @@ +24134f419615a92131c5b25acb3a624d \ No newline at end of file diff --git a/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a6b52b7851750f28d53508e63c52a69f7_cgraph.svg b/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a6b52b7851750f28d53508e63c52a69f7_cgraph.svg new file mode 100644 index 000000000..c73ec6d81 --- /dev/null +++ b/df/d34/classprobability_1_1windowed__median_1_1_windowed_median_a6b52b7851750f28d53508e63c52a69f7_cgraph.svg @@ -0,0 +1,118 @@ + + + + + + +probability::windowed_median::WindowedMedian::insert + + + +Node1 + + +probability::windowed +_median::WindowedMedian +::insert + + + + + +Node2 + + +probability::windowed +_median::WindowedMedian +::eraseFromSorted + + + + + +Node1->Node2 + + + + + +Node3 + + +std::list::front + + + + + +Node1->Node3 + + + + + +Node4 + + +probability::windowed +_median::WindowedMedian +::insertToSorted + + + + + +Node1->Node4 + + + + + +Node5 + + +std::list::pop_front + + + + + +Node1->Node5 + + + + + +Node6 + + +std::list::push_back + + + + + +Node1->Node6 + + + + + +Node7 + + +std::list::size + + + + + +Node1->Node7 + + + + + diff --git a/dir_82e494173a87936756866de2fa774307.html b/dir_82e494173a87936756866de2fa774307.html index 7cad6432e..b8790f9cd 100644 --- a/dir_82e494173a87936756866de2fa774307.html +++ b/dir_82e494173a87936756866de2fa774307.html @@ -108,6 +108,9 @@ Files file  poisson_dist.cpp  Poisson statistics
      +file  windowed_median.cpp + An implementation of a median calculation of a sliding window along a data stream.
    diff --git a/dir_82e494173a87936756866de2fa774307.js b/dir_82e494173a87936756866de2fa774307.js index 26c72285d..e45f93992 100644 --- a/dir_82e494173a87936756866de2fa774307.js +++ b/dir_82e494173a87936756866de2fa774307.js @@ -3,5 +3,6 @@ var dir_82e494173a87936756866de2fa774307 = [ "addition_rule.cpp", "d6/d4a/addition__rule_8cpp.html", "d6/d4a/addition__rule_8cpp" ], [ "bayes_theorem.cpp", "d5/d67/bayes__theorem_8cpp.html", "d5/d67/bayes__theorem_8cpp" ], [ "binomial_dist.cpp", "d6/db0/binomial__dist_8cpp.html", "d6/db0/binomial__dist_8cpp" ], - [ "poisson_dist.cpp", "d9/d24/poisson__dist_8cpp.html", "d9/d24/poisson__dist_8cpp" ] + [ "poisson_dist.cpp", "d9/d24/poisson__dist_8cpp.html", "d9/d24/poisson__dist_8cpp" ], + [ "windowed_median.cpp", "d1/ded/windowed__median_8cpp.html", "d1/ded/windowed__median_8cpp" ] ]; \ No newline at end of file diff --git a/files.html b/files.html index e2b522871..848a45111 100644 --- a/files.html +++ b/files.html @@ -291,6 +291,7 @@ solve-a-rat-in-a-maze-c-java-pytho/"  bayes_theorem.cppBayes' theorem  binomial_dist.cppBinomial distribution example  poisson_dist.cppPoisson statistics + windowed_median.cppAn implementation of a median calculation of a sliding window along a data stream   range_queries  fenwick_tree.cppFenwick tree  heavy_light_decomposition.cppHeavy Light Decomposition implementation diff --git a/functions.html b/functions.html index a4073aa91..c8cf95d8b 100644 --- a/functions.html +++ b/functions.html @@ -96,9 +96,13 @@ $(document).ready(function(){initNavTree('functions.html',''); initResizable();
  3. __detailed_single_prediction() : machine_learning::neural_network::NeuralNetwork
  4. __get_integer_from_string() : uint128_t, uint256_t
  5. _digits : large_number
  6. +
  7. _itMedian : probability::windowed_median::WindowedMedian
  8. _lez() : uint128_t, uint256_t
  9. _mod : hash_chain
  10. +
  11. _sortedValues : probability::windowed_median::WindowedMedian
  12. _trz() : uint128_t, uint256_t
  13. +
  14. _window : probability::windowed_median::WindowedMedian
  15. +
  16. _windowSize : probability::windowed_median::WindowedMedian
  17. diff --git a/functions_e.html b/functions_e.html index 809e689f9..1032bd44b 100644 --- a/functions_e.html +++ b/functions_e.html @@ -100,6 +100,7 @@ $(document).ready(function(){initNavTree('functions_e.html',''); initResizable()
  18. enQueue() : queue< Kind >
  19. Entry() : double_hashing::Entry, linear_probing::Entry, quadratic_probing::Entry
  20. erase() : data_structures::linked_list::list
  21. +
  22. eraseFromSorted() : probability::windowed_median::WindowedMedian
  23. eta : machine_learning::adaline
  24. evaluate() : machine_learning::neural_network::NeuralNetwork
  25. evaluate_from_csv() : machine_learning::neural_network::NeuralNetwork
  26. diff --git a/functions_func.js b/functions_func.js index d55a7000a..e66a74bd8 100644 --- a/functions_func.js +++ b/functions_func.js @@ -22,5 +22,6 @@ var functions_func = [ "t", "functions_func_t.html", null ], [ "u", "functions_func_u.html", null ], [ "v", "functions_func_v.html", null ], + [ "w", "functions_func_w.html", null ], [ "~", "functions_func_~.html", null ] ]; \ No newline at end of file diff --git a/functions_func_e.html b/functions_func_e.html index 266350ddf..b89a528b0 100644 --- a/functions_func_e.html +++ b/functions_func_e.html @@ -100,6 +100,7 @@ $(document).ready(function(){initNavTree('functions_func_e.html',''); initResiza
  27. enQueue() : queue< Kind >
  28. Entry() : double_hashing::Entry, linear_probing::Entry, quadratic_probing::Entry
  29. erase() : data_structures::linked_list::list
  30. +
  31. eraseFromSorted() : probability::windowed_median::WindowedMedian
  32. evaluate() : machine_learning::neural_network::NeuralNetwork
  33. evaluate_from_csv() : machine_learning::neural_network::NeuralNetwork
  34. extractMin() : MinHeap
  35. diff --git a/functions_func_g.html b/functions_func_g.html index 6089ec935..06fbc7337 100644 --- a/functions_func_g.html +++ b/functions_func_g.html @@ -122,6 +122,8 @@ $(document).ready(function(){initNavTree('functions_func_g.html',''); initResiza
  36. GetItemRightChild() : data_structures::tree_234::Node
  37. GetLeftmostChild() : data_structures::tree_234::Node
  38. GetMaxItem() : data_structures::tree_234::Node
  39. +
  40. getMedian() : probability::windowed_median::WindowedMedian
  41. +
  42. getMedianNaive() : probability::windowed_median::WindowedMedian
  43. getMin() : MinHeap
  44. GetMinItem() : data_structures::tree_234::Node
  45. GetNextPossibleChild() : data_structures::tree_234::Node
  46. diff --git a/functions_func_i.html b/functions_func_i.html index d878e7f9f..dcb9e398f 100644 --- a/functions_func_i.html +++ b/functions_func_i.html @@ -99,16 +99,17 @@ $(document).ready(function(){initNavTree('functions_func_i.html',''); initResiza
  47. init() : range_queries::heavy_light_decomposition::HLD< X >, range_queries::heavy_light_decomposition::Tree< X >
  48. inOrderIterative() : others::iterative_tree_traversals::BinaryTree
  49. insert() : binary_search_tree< T >, data_structures::linked_list::list, data_structures::list_array::list
  50. -
  51. Insert() : data_structures::tree_234::Tree234
  52. +
  53. Insert() : data_structures::tree_234::Tree234
  54. insert() : data_structures::trie, data_structures::trie_using_hashmap::Trie
  55. Insert() : operations_on_datastructures::trie_operations::Tnode
  56. -
  57. insert() : Trie
  58. +
  59. insert() : probability::windowed_median::WindowedMedian, Trie
  60. insertElement() : data_structures::SkipList
  61. InsertItem() : data_structures::tree_234::Node
  62. InsertItemByIndex() : data_structures::tree_234::Node
  63. insertKey() : MinHeap
  64. InsertPostMerge() : data_structures::tree_234::Tree234
  65. InsertPreSplit() : data_structures::tree_234::Tree234
  66. +
  67. insertToSorted() : probability::windowed_median::WindowedMedian
  68. Is2Node() : data_structures::tree_234::Node
  69. Is34Node() : data_structures::tree_234::Node
  70. is_bipartite() : graph::is_graph_bipartite::Graph
  71. diff --git a/functions_func_w.html b/functions_func_w.html new file mode 100644 index 000000000..c3f33d11a --- /dev/null +++ b/functions_func_w.html @@ -0,0 +1,107 @@ + + + + + + + +Algorithms_in_C++: Class Members - Functions + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Algorithms_in_C++ 1.0.0 +
    +
    Set of algorithms implemented in C++.
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +  + +

    - w -

    +
    +
    + + + + diff --git a/functions_g.html b/functions_g.html index 47cf61363..7dd4333bb 100644 --- a/functions_g.html +++ b/functions_g.html @@ -122,6 +122,8 @@ $(document).ready(function(){initNavTree('functions_g.html',''); initResizable()
  72. GetItemRightChild() : data_structures::tree_234::Node
  73. GetLeftmostChild() : data_structures::tree_234::Node
  74. GetMaxItem() : data_structures::tree_234::Node
  75. +
  76. getMedian() : probability::windowed_median::WindowedMedian
  77. +
  78. getMedianNaive() : probability::windowed_median::WindowedMedian
  79. getMin() : MinHeap
  80. GetMinItem() : data_structures::tree_234::Node
  81. GetNextPossibleChild() : data_structures::tree_234::Node
  82. diff --git a/functions_i.html b/functions_i.html index 643c7af3c..6af942dfa 100644 --- a/functions_i.html +++ b/functions_i.html @@ -99,16 +99,17 @@ $(document).ready(function(){initNavTree('functions_i.html',''); initResizable()
  83. init() : range_queries::heavy_light_decomposition::HLD< X >, range_queries::heavy_light_decomposition::Tree< X >
  84. inOrderIterative() : others::iterative_tree_traversals::BinaryTree
  85. insert() : binary_search_tree< T >, data_structures::linked_list::list, data_structures::list_array::list
  86. -
  87. Insert() : data_structures::tree_234::Tree234
  88. +
  89. Insert() : data_structures::tree_234::Tree234
  90. insert() : data_structures::trie, data_structures::trie_using_hashmap::Trie
  91. Insert() : operations_on_datastructures::trie_operations::Tnode
  92. -
  93. insert() : Trie
  94. +
  95. insert() : probability::windowed_median::WindowedMedian, Trie
  96. insertElement() : data_structures::SkipList
  97. InsertItem() : data_structures::tree_234::Node
  98. InsertItemByIndex() : data_structures::tree_234::Node
  99. insertKey() : MinHeap
  100. InsertPostMerge() : data_structures::tree_234::Tree234
  101. InsertPreSplit() : data_structures::tree_234::Tree234
  102. +
  103. insertToSorted() : probability::windowed_median::WindowedMedian
  104. Is2Node() : data_structures::tree_234::Node
  105. Is34Node() : data_structures::tree_234::Node
  106. is_bipartite() : graph::is_graph_bipartite::Graph
  107. diff --git a/functions_vars.html b/functions_vars.html index 352e5c8a9..d1236b4e1 100644 --- a/functions_vars.html +++ b/functions_vars.html @@ -94,7 +94,11 @@ $(document).ready(function(){initNavTree('functions_vars.html',''); initResizabl

    - _ -

    diff --git a/functions_w.html b/functions_w.html index 0832f8276..a0ebe79e8 100644 --- a/functions_w.html +++ b/functions_w.html @@ -94,6 +94,7 @@ $(document).ready(function(){initNavTree('functions_w.html',''); initResizable()

    - w -

    diff --git a/globals_func_i.html b/globals_func_i.html index eaac1ff58..7ce39a9c8 100644 --- a/globals_func_i.html +++ b/globals_func_i.html @@ -104,8 +104,8 @@ $(document).ready(function(){initNavTree('globals_func_i.html',''); initResizabl
  108. is_happy() : happy_number.cpp
  109. is_prime() : check_prime.cpp
  110. is_square() : ordinary_least_squares_regressor.cpp
  111. -
  112. IsPrime() : primality_test.cpp
  113. isPrime() : modular_inverse_fermat_little_theorem.cpp
  114. +
  115. IsPrime() : primality_test.cpp
  116. it_ternary_search() : ternary_search.cpp
  117. diff --git a/globals_func_m.html b/globals_func_m.html index dafb000d8..dd40cee1f 100644 --- a/globals_func_m.html +++ b/globals_func_m.html @@ -93,7 +93,7 @@ $(document).ready(function(){initNavTree('globals_func_m.html',''); initResizabl  

    - m -