From 426cd4e9e796d4a6ffb29b5e0a6b9f814a6b38b5 Mon Sep 17 00:00:00 2001 From: realstealthninja Date: Sat, 3 Oct 2026 10:34:41 +0000 Subject: [PATCH] Documentation for fdcc29b0ac2848e9d1a8d926e171cc5b39f97759 --- annotated.html | 2 +- d1/ded/windowed__median_8cpp.html | 2 +- d1/ded/windowed__median_8cpp_source.html | 2 +- d4/dd1/conditional__probability_8cpp.html | 397 ++++++++++++++++++ d4/dd1/conditional__probability_8cpp.js | 6 + .../conditional__probability_8cpp_source.html | 260 ++++++++++++ d4/ded/namespaceprobability.html | 7 +- d6/db0/binomial__dist_8cpp.html | 2 +- d6/db0/binomial__dist_8cpp_source.html | 2 +- d9/d24/poisson__dist_8cpp.html | 2 +- d9/d24/poisson__dist_8cpp_source.html | 2 +- d9/da2/exponential__dist_8cpp.html | 2 +- d9/da2/exponential__dist_8cpp_source.html | 2 +- de/d72/geometric__dist_8cpp.html | 2 +- de/d72/geometric__dist_8cpp_source.html | 2 +- .../conditional__probability_8cpp__incl.map | 13 + .../conditional__probability_8cpp__incl.md5 | 1 + .../conditional__probability_8cpp__incl.svg | 132 ++++++ ...onditional__probability_8cpp__incl_org.svg | 112 +++++ df/d4a/namespaceconditional__probability.html | 163 +++++++ dir_82e494173a87936756866de2fa774307.html | 2 + dir_82e494173a87936756866de2fa774307.js | 1 + doxygen_crawl.html | 6 + files.html | 169 ++++---- globals_func_m.html | 2 +- globals_func_t.html | 2 +- globals_m.html | 2 +- globals_t.html | 2 +- namespaces.html | 273 ++++++------ namespaces_dup.js | 1 + navtreedata.js | 20 +- navtreeindex0.js | 90 ++-- navtreeindex1.js | 90 ++-- navtreeindex10.js | 130 +++--- navtreeindex11.js | 124 +++--- navtreeindex12.js | 98 ++--- navtreeindex13.js | 5 + navtreeindex2.js | 22 +- navtreeindex3.js | 130 +++--- navtreeindex4.js | 96 ++--- navtreeindex5.js | 88 ++-- navtreeindex6.js | 164 ++++---- navtreeindex7.js | 142 +++---- navtreeindex8.js | 58 +-- navtreeindex9.js | 40 +- search/all_12.js | 2 +- search/all_19.js | 2 +- search/all_8.js | 125 +++--- search/files_3.js | 17 +- search/functions_14.js | 2 +- search/functions_3.js | 59 +-- search/functions_d.js | 2 +- search/namespaces_2.js | 13 +- 53 files changed, 2101 insertions(+), 991 deletions(-) create mode 100644 d4/dd1/conditional__probability_8cpp.html create mode 100644 d4/dd1/conditional__probability_8cpp.js create mode 100644 d4/dd1/conditional__probability_8cpp_source.html create mode 100644 de/dff/conditional__probability_8cpp__incl.map create mode 100644 de/dff/conditional__probability_8cpp__incl.md5 create mode 100644 de/dff/conditional__probability_8cpp__incl.svg create mode 100644 de/dff/conditional__probability_8cpp__incl_org.svg create mode 100644 df/d4a/namespaceconditional__probability.html diff --git a/annotated.html b/annotated.html index 5a85b5abb..3aa40975a 100644 --- a/annotated.html +++ b/annotated.html @@ -243,7 +243,7 @@ document.addEventListener('DOMContentLoaded',() => { initNavTree('annotated.html   Nrecursive_tree_traversals    CNodeThe structure to hold Nodes of the tree    CBTBT used to make the entire structure of the binary tree and the functions associated with the binary tree - NprobabilityProbability algorithms + NprobabilityFor std::string   Ngeometric_dist    Cgeometric_distributionA class to model the geometric distribution   Nwindowed_median diff --git a/d1/ded/windowed__median_8cpp.html b/d1/ded/windowed__median_8cpp.html index ce7444312..f9dc6868a 100644 --- a/d1/ded/windowed__median_8cpp.html +++ b/d1/ded/windowed__median_8cpp.html @@ -162,7 +162,7 @@ Classes

Namespaces

namespace  probability - Probability algorithms.
+ for std::string
namespace  windowed_median  Functions for the Windowed Median algorithm implementation.
diff --git a/d1/ded/windowed__median_8cpp_source.html b/d1/ded/windowed__median_8cpp_source.html index 4d7dcf9d0..667921ba0 100644 --- a/d1/ded/windowed__median_8cpp_source.html +++ b/d1/ded/windowed__median_8cpp_source.html @@ -281,7 +281,7 @@ document.addEventListener('DOMContentLoaded',() => { initNavTree('d1/ded/windowe
const size_type _windowSize
sliding window size
void eraseFromSorted(int value)
Erases a value from a sorted multi-value BST.
int main()
Main function.
-
Probability algorithms.
+
for std::string
Functions for the Windowed Median algorithm implementation.
diff --git a/d4/dd1/conditional__probability_8cpp.html b/d4/dd1/conditional__probability_8cpp.html new file mode 100644 index 000000000..3f6ba8a85 --- /dev/null +++ b/d4/dd1/conditional__probability_8cpp.html @@ -0,0 +1,397 @@ + + + + + + + + +TheAlgorithms/C++: probability/conditional_probability.cpp File Reference + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + +
+
TheAlgorithms/C++ 1.0.0 +
+
All the algorithms implemented in C++
+
+ + + + + + + + + + + +
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
conditional_probability.cpp File Reference
+
+
+ +

Conditional Probability +More...

+
#include <cassert>
+#include <cmath>
+#include <iostream>
+#include <stdexcept>
+#include <string>
+
+Include dependency graph for conditional_probability.cpp:
+
+
+
+
+

Go to the source code of this file.

+ + + + + + +

+Namespaces

namespace  probability
 for std::string
namespace  conditional_probability
 Functions for the Conditional Probability algorithm implementation.
+ + + + + + + +

+Functions

double probability::conditional_probability::conditional_compute (double p_intersect, double p_given)
 Computes the conditional probability P(X|Y).
static void test ()
 Self-test implementations.
int main ()
 Main function.
+

Detailed Description

+

Conditional Probability

+

In probability theory, conditional probability is a measure of the probability of an event occurring, given that another event (by assumption, presumption, assertion, or evidence) is already known to have occurred.

+

This particular method relies on event A occurring with some sort of relationship with another event B. In this situation, the event A can be analyzed by a conditional probability with respect to B.

+

If the event of interest is A and the event B is known or assumed to have occurred, "the conditional probability of A given B", or "the probability of +A under the condition B" is given by the formula:

+

+\[P(A \mid B) = \frac{P(A \cap B)}{P(B)}\] +

+

where: \(P(B) > 0\).

+
Author
SomrajBanik
+ +

Definition in file conditional_probability.cpp.

+

Function Documentation

+ +

◆ conditional_compute()

+ +
+
+ + + + + + + + + + + +
double probability::conditional_probability::conditional_compute (double p_intersect,
double p_given )
+
+ +

Computes the conditional probability P(X|Y).

+
Parameters
+ + + +
p_intersectprobability that both X and Y occur, in [0, P(Y)]
p_givenprobability of the event that is given (Y), in (0, 1]
+
+
+
Returns
P(X|Y)
+
Exceptions
+ + +
std::invalid_argumentif p_given is not in (0, 1], or if p_intersect is not in [0, p_given]
+
+
+ +

Definition at line 51 of file conditional_probability.cpp.

+
51 {
+
52 if (p_given <= 0.0 || p_given > 1.0) {
+
53 throw std::invalid_argument("The given probability must be in (0, 1].");
+
54 }
+
55 if (p_intersect < 0.0 || p_intersect > p_given) {
+
56 throw std::invalid_argument(
+
57 "P(intersection) must be between 0 and the given probability.");
+
58 }
+
59
+
60 return p_intersect / p_given;
+
61}
+
+
+
+ +

◆ main()

+ +
+
+ + + + + + + +
int main (void )
+
+ +

Main function.

+
Returns
0 on exit
+ +

Definition at line 159 of file conditional_probability.cpp.

+
159 {
+
160 test(); // run self test implementations
+
161 return 0;
+
162}
+
void test()
+
+
+
+ +

◆ test()

+ +
+
+ + + + + +
+ + + + + + + +
void test ()
+
+static
+
+ +

Self-test implementations.

+
Returns
void
+

tolerance for double comparison

+ +

Definition at line 70 of file conditional_probability.cpp.

+
70 {
+ +
72
+
73 const double epsilon = 1e-9;
+
74
+
75 std::cout << "\n\n";
+
76 std::cout << "Testing conditional probability...\n\n";
+
77
+
78 // Test case 1
+
79 std::cout << "Test 1: P(A and B) = 0.2, P(B) = 0.5\n";
+
80 std::cout << "Expected: P(A|B) = 0.4\n";
+
81 std::cout << "Result: P(A|B) = " << conditional_compute(0.2, 0.5) << "\n";
+
82 assert(std::fabs(conditional_compute(0.2, 0.5) - 0.4) < epsilon);
+
83 std::cout << "--PASSED--\n\n";
+
84
+
85 // Test case 2
+
86 std::cout << "Test 2: A always happens when B does (B is a subset of A)\n";
+
87 std::cout << "Expected: P(A|B) = 1.0\n";
+
88 std::cout << "Result: P(A|B) = " << conditional_compute(0.5, 0.5) << "\n";
+
89 assert(std::fabs(conditional_compute(0.5, 0.5) - 1.0) < epsilon);
+
90 std::cout << "--PASSED--\n\n";
+
91
+
92 // Test case 3
+
93 std::cout << "Test 3: A and B never happen together (mutually exclusive "
+
94 "events)\n";
+
95 std::cout << "Expected: P(A|B) = 0.0\n";
+
96 std::cout << "Result: P(A|B) = " << conditional_compute(0.0, 0.3) << "\n";
+
97 assert(std::fabs(conditional_compute(0.0, 0.3) - 0.0) < epsilon);
+
98 std::cout << "--PASSED--\n\n";
+
99
+
100 // Test case 4
+
101 std::cout << "Test 4: One die, A = 'roll is 2', B = 'roll is even'\n";
+
102 std::cout << "Expected: P(A|B) = 1/3 or 0.333333(approx)\n";
+
103 std::cout << "Result: P(A|B) = "
+
104 << conditional_compute(1.0 / 6.0, 1.0 / 2.0) << " (approx) "
+
105 << "\n";
+
106 assert(std::fabs(conditional_compute(1.0 / 6.0, 1.0 / 2.0) - 1.0 / 3.0) <
+
107 epsilon);
+
108 std::cout << "--PASSED--\n\n";
+
109
+
110 // Error handling test 1 (Test case 5)
+
111 std::cout << "Test 5: Error handling - P(B) = 0 (invalid)\n";
+
112 bool thrown = false;
+
113 try {
+
114 conditional_compute(0.2, 0.0);
+
115 } catch (const std::invalid_argument &e) {
+
116 std::cout << "Error caught: " << e.what() << "\n";
+
117 assert(std::string(e.what()) ==
+
118 "The given probability must be in (0, 1].");
+
119 thrown = true;
+
120 }
+
121 assert(thrown);
+
122 std::cout << "--PASSED--\n\n";
+
123
+
124 // Error handling test 2 (Test case 6)
+
125 std::cout << "Test 6: Error handling - P(A and B) < 0 (invalid)\n";
+
126 thrown = false;
+
127 try {
+
128 conditional_compute(-0.1, 0.5);
+
129 } catch (const std::invalid_argument &e) {
+
130 std::cout << "Error caught: " << e.what() << "\n";
+
131 assert(std::string(e.what()) ==
+
132 "P(intersection) must be between 0 and the given probability.");
+
133 thrown = true;
+
134 }
+
135 assert(thrown);
+
136 std::cout << "--PASSED--\n\n";
+
137
+
138 // Error handling test 3 (Test case 7)
+
139 std::cout << "Test 7: Error handling - P(B) > 1 (invalid)\n";
+
140 thrown = false;
+
141 try {
+
142 conditional_compute(0.2, 1.5);
+
143 } catch (const std::invalid_argument &e) {
+
144 std::cout << "Error caught: " << e.what() << "\n";
+
145 assert(std::string(e.what()) ==
+
146 "The given probability must be in (0, 1].");
+
147 thrown = true;
+
148 }
+
149 assert(thrown);
+
150 std::cout << "--PASSED--\n\n";
+
151
+
152 std::cout << "All tests have successfully passed!\n";
+
153}
+
double conditional_compute(double p_intersect, double p_given)
Computes the conditional probability P(X|Y).
+
+
+
+
+
+ +
+ + + + diff --git a/d4/dd1/conditional__probability_8cpp.js b/d4/dd1/conditional__probability_8cpp.js new file mode 100644 index 000000000..872dcee2e --- /dev/null +++ b/d4/dd1/conditional__probability_8cpp.js @@ -0,0 +1,6 @@ +var conditional__probability_8cpp = +[ + [ "probability::conditional_probability::conditional_compute", "d4/dd1/conditional__probability_8cpp.html#a60e0634bfe8685d623ab52512e84cc9b", null ], + [ "main", "d4/dd1/conditional__probability_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ], + [ "test", "d4/dd1/conditional__probability_8cpp.html#aa8dca7b867074164d5f45b0f3851269d", null ] +]; \ No newline at end of file diff --git a/d4/dd1/conditional__probability_8cpp_source.html b/d4/dd1/conditional__probability_8cpp_source.html new file mode 100644 index 000000000..73cf8b74a --- /dev/null +++ b/d4/dd1/conditional__probability_8cpp_source.html @@ -0,0 +1,260 @@ + + + + + + + + +TheAlgorithms/C++: probability/conditional_probability.cpp Source File + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
TheAlgorithms/C++ 1.0.0 +
+
All the algorithms implemented in C++
+
+
+ + + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
conditional_probability.cpp
+
+
+Go to the documentation of this file.
1
+
24
+
25#include <cassert>
+
26#include <cmath>
+
27#include <iostream>
+
28#include <stdexcept>
+
29#include <string>
+
30
+
35namespace probability {
+ +
+
51double conditional_compute(double p_intersect, double p_given) {
+
52 if (p_given <= 0.0 || p_given > 1.0) {
+
53 throw std::invalid_argument("The given probability must be in (0, 1].");
+
54 }
+
55 if (p_intersect < 0.0 || p_intersect > p_given) {
+
56 throw std::invalid_argument(
+
57 "P(intersection) must be between 0 and the given probability.");
+
58 }
+
59
+
60 return p_intersect / p_given;
+
61}
+
+
62
+
63} // namespace conditional_probability
+
64} // namespace probability
+
65
+
+
70static void test() {
+ +
72
+
73 const double epsilon = 1e-9;
+
74
+
75 std::cout << "\n\n";
+
76 std::cout << "Testing conditional probability...\n\n";
+
77
+
78 // Test case 1
+
79 std::cout << "Test 1: P(A and B) = 0.2, P(B) = 0.5\n";
+
80 std::cout << "Expected: P(A|B) = 0.4\n";
+
81 std::cout << "Result: P(A|B) = " << conditional_compute(0.2, 0.5) << "\n";
+
82 assert(std::fabs(conditional_compute(0.2, 0.5) - 0.4) < epsilon);
+
83 std::cout << "--PASSED--\n\n";
+
84
+
85 // Test case 2
+
86 std::cout << "Test 2: A always happens when B does (B is a subset of A)\n";
+
87 std::cout << "Expected: P(A|B) = 1.0\n";
+
88 std::cout << "Result: P(A|B) = " << conditional_compute(0.5, 0.5) << "\n";
+
89 assert(std::fabs(conditional_compute(0.5, 0.5) - 1.0) < epsilon);
+
90 std::cout << "--PASSED--\n\n";
+
91
+
92 // Test case 3
+
93 std::cout << "Test 3: A and B never happen together (mutually exclusive "
+
94 "events)\n";
+
95 std::cout << "Expected: P(A|B) = 0.0\n";
+
96 std::cout << "Result: P(A|B) = " << conditional_compute(0.0, 0.3) << "\n";
+
97 assert(std::fabs(conditional_compute(0.0, 0.3) - 0.0) < epsilon);
+
98 std::cout << "--PASSED--\n\n";
+
99
+
100 // Test case 4
+
101 std::cout << "Test 4: One die, A = 'roll is 2', B = 'roll is even'\n";
+
102 std::cout << "Expected: P(A|B) = 1/3 or 0.333333(approx)\n";
+
103 std::cout << "Result: P(A|B) = "
+
104 << conditional_compute(1.0 / 6.0, 1.0 / 2.0) << " (approx) "
+
105 << "\n";
+
106 assert(std::fabs(conditional_compute(1.0 / 6.0, 1.0 / 2.0) - 1.0 / 3.0) <
+
107 epsilon);
+
108 std::cout << "--PASSED--\n\n";
+
109
+
110 // Error handling test 1 (Test case 5)
+
111 std::cout << "Test 5: Error handling - P(B) = 0 (invalid)\n";
+
112 bool thrown = false;
+
113 try {
+
114 conditional_compute(0.2, 0.0);
+
115 } catch (const std::invalid_argument &e) {
+
116 std::cout << "Error caught: " << e.what() << "\n";
+
117 assert(std::string(e.what()) ==
+
118 "The given probability must be in (0, 1].");
+
119 thrown = true;
+
120 }
+
121 assert(thrown);
+
122 std::cout << "--PASSED--\n\n";
+
123
+
124 // Error handling test 2 (Test case 6)
+
125 std::cout << "Test 6: Error handling - P(A and B) < 0 (invalid)\n";
+
126 thrown = false;
+
127 try {
+
128 conditional_compute(-0.1, 0.5);
+
129 } catch (const std::invalid_argument &e) {
+
130 std::cout << "Error caught: " << e.what() << "\n";
+
131 assert(std::string(e.what()) ==
+
132 "P(intersection) must be between 0 and the given probability.");
+
133 thrown = true;
+
134 }
+
135 assert(thrown);
+
136 std::cout << "--PASSED--\n\n";
+
137
+
138 // Error handling test 3 (Test case 7)
+
139 std::cout << "Test 7: Error handling - P(B) > 1 (invalid)\n";
+
140 thrown = false;
+
141 try {
+
142 conditional_compute(0.2, 1.5);
+
143 } catch (const std::invalid_argument &e) {
+
144 std::cout << "Error caught: " << e.what() << "\n";
+
145 assert(std::string(e.what()) ==
+
146 "The given probability must be in (0, 1].");
+
147 thrown = true;
+
148 }
+
149 assert(thrown);
+
150 std::cout << "--PASSED--\n\n";
+
151
+
152 std::cout << "All tests have successfully passed!\n";
+
153}
+
+
154
+
+
159int main() {
+
160 test(); // run self test implementations
+
161 return 0;
+
162}
+
+
void test()
+
double conditional_compute(double p_intersect, double p_given)
Computes the conditional probability P(X|Y).
+
int main()
Main function.
+
Functions for the Conditional Probability algorithm implementation.
+
for std::string
+
+
+
+ + + + diff --git a/d4/ded/namespaceprobability.html b/d4/ded/namespaceprobability.html index 84096ea96..dd41a6309 100644 --- a/d4/ded/namespaceprobability.html +++ b/d4/ded/namespaceprobability.html @@ -138,10 +138,13 @@ document.addEventListener('DOMContentLoaded',() => { initNavTree('d4/ded/namespa
-

Probability algorithms. +

for std::string More...

Detailed Description

-

Probability algorithms.

+

for std::string

+

Probability algorithms.

+

for assert for std::fabs for IO operations for std::invalid_argument

+

Probability algorithms

for assert for math functions for fixed size data types for time to initialize rng for std::cout for std::numeric_limits for random numbers for std::vector

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 for std::vector - needed in testing

diff --git a/d6/db0/binomial__dist_8cpp.html b/d6/db0/binomial__dist_8cpp.html index b575c5e44..cdcdd24c3 100644 --- a/d6/db0/binomial__dist_8cpp.html +++ b/d6/db0/binomial__dist_8cpp.html @@ -244,7 +244,7 @@ Functions
80 return probability;
81}
double nCr(double n, double r)
-
Probability algorithms.
+
for std::string
diff --git a/d6/db0/binomial__dist_8cpp_source.html b/d6/db0/binomial__dist_8cpp_source.html index 12c4ae41f..7f2b48b0b 100644 --- a/d6/db0/binomial__dist_8cpp_source.html +++ b/d6/db0/binomial__dist_8cpp_source.html @@ -195,7 +195,7 @@ document.addEventListener('DOMContentLoaded',() => { initNavTree('d6/db0/binomia
double binomial_variance(double n, double p)
double binomial_standard_deviation(double n, double p)
int main()
Main function.
-
Probability algorithms.
+
for std::string
diff --git a/d9/d24/poisson__dist_8cpp.html b/d9/d24/poisson__dist_8cpp.html index 86a7d7952..851670927 100644 --- a/d9/d24/poisson__dist_8cpp.html +++ b/d9/d24/poisson__dist_8cpp.html @@ -295,7 +295,7 @@ Functions
58 }
59 return probability;
60}
-
Probability algorithms.
+
for std::string
std::string lower(std::string word)
function to convert a C++ string to lower case
diff --git a/d9/d24/poisson__dist_8cpp_source.html b/d9/d24/poisson__dist_8cpp_source.html index 5583fac90..26ae6f69b 100644 --- a/d9/d24/poisson__dist_8cpp_source.html +++ b/d9/d24/poisson__dist_8cpp_source.html @@ -181,7 +181,7 @@ document.addEventListener('DOMContentLoaded',() => { initNavTree('d9/d24/poisson
79}
int main()
Main function.
-
Probability algorithms.
+
for std::string
double fact(double x)
double poisson_x_successes(double expected, double x)
double poisson_rate(double events, double timeframe)
diff --git a/d9/da2/exponential__dist_8cpp.html b/d9/da2/exponential__dist_8cpp.html index c6deeb548..5eb988ed1 100644 --- a/d9/da2/exponential__dist_8cpp.html +++ b/d9/da2/exponential__dist_8cpp.html @@ -156,7 +156,7 @@ Include dependency graph for exponential_dist.cpp:

Namespaces

namespace  probability - Probability algorithms.
+ for std::string
namespace  exponential_dist  Functions for the Exponential Distribution algorithm implementation.
diff --git a/d9/da2/exponential__dist_8cpp_source.html b/d9/da2/exponential__dist_8cpp_source.html index 960af62f3..3b79007d5 100644 --- a/d9/da2/exponential__dist_8cpp_source.html +++ b/d9/da2/exponential__dist_8cpp_source.html @@ -246,7 +246,7 @@ document.addEventListener('DOMContentLoaded',() => { initNavTree('d9/da2/exponen
double exponential_var(double lambda)
the variance of the exponential distribution
int main()
Main function.
Functions for the Geometric Distribution algorithm implementation.
-
Probability algorithms.
+
for std::string
diff --git a/de/d72/geometric__dist_8cpp.html b/de/d72/geometric__dist_8cpp.html index 1af5d848a..e023c68a8 100644 --- a/de/d72/geometric__dist_8cpp.html +++ b/de/d72/geometric__dist_8cpp.html @@ -164,7 +164,7 @@ Classes - +

Namespaces

namespace  probability
 Probability algorithms.
 for std::string
namespace  geometric_dist
 Functions for the Geometric Distribution algorithm implementation.
diff --git a/de/d72/geometric__dist_8cpp_source.html b/de/d72/geometric__dist_8cpp_source.html index 28a1c50b8..163162e6f 100644 --- a/de/d72/geometric__dist_8cpp_source.html +++ b/de/d72/geometric__dist_8cpp_source.html @@ -307,7 +307,7 @@ document.addEventListener('DOMContentLoaded',() => { initNavTree('de/d72/geometr
void sample_test(const probability::geometric_dist::geometric_distribution &dist)
Tests the sampling method of the geometric distribution.
float generate_uniform()
Returns a random number between [0,1].
Functions for the Geometric Distribution algorithm implementation.
-
Probability algorithms.
+
for std::string
diff --git a/de/dff/conditional__probability_8cpp__incl.map b/de/dff/conditional__probability_8cpp__incl.map new file mode 100644 index 000000000..addad293f --- /dev/null +++ b/de/dff/conditional__probability_8cpp__incl.map @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/de/dff/conditional__probability_8cpp__incl.md5 b/de/dff/conditional__probability_8cpp__incl.md5 new file mode 100644 index 000000000..8622b2133 --- /dev/null +++ b/de/dff/conditional__probability_8cpp__incl.md5 @@ -0,0 +1 @@ +58ea09e10596a57a84582a29b1e464aa \ No newline at end of file diff --git a/de/dff/conditional__probability_8cpp__incl.svg b/de/dff/conditional__probability_8cpp__incl.svg new file mode 100644 index 000000000..029306787 --- /dev/null +++ b/de/dff/conditional__probability_8cpp__incl.svg @@ -0,0 +1,132 @@ + + + + + + + + + + + + +probability/conditional_probability.cpp + + +Node1 + + +probability/conditional +_probability.cpp + + + + + +Node2 + + +cassert + + + + + +Node1->Node2 + + + + + + + + +Node3 + + +cmath + + + + + +Node1->Node3 + + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + + + + + + +Node5 + + +stdexcept + + + + + +Node1->Node5 + + + + + + + + +Node6 + + +string + + + + + +Node1->Node6 + + + + + + + + + + + + diff --git a/de/dff/conditional__probability_8cpp__incl_org.svg b/de/dff/conditional__probability_8cpp__incl_org.svg new file mode 100644 index 000000000..fc654c692 --- /dev/null +++ b/de/dff/conditional__probability_8cpp__incl_org.svg @@ -0,0 +1,112 @@ + + + + + + +probability/conditional_probability.cpp + + +Node1 + + +probability/conditional +_probability.cpp + + + + + +Node2 + + +cassert + + + + + +Node1->Node2 + + + + + + + + +Node3 + + +cmath + + + + + +Node1->Node3 + + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + + + + + + +Node5 + + +stdexcept + + + + + +Node1->Node5 + + + + + + + + +Node6 + + +string + + + + + +Node1->Node6 + + + + + + + + diff --git a/df/d4a/namespaceconditional__probability.html b/df/d4a/namespaceconditional__probability.html new file mode 100644 index 000000000..9d5f1efea --- /dev/null +++ b/df/d4a/namespaceconditional__probability.html @@ -0,0 +1,163 @@ + + + + + + + + +TheAlgorithms/C++: conditional_probability Namespace Reference + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + +
+
TheAlgorithms/C++ 1.0.0 +
+
All the algorithms implemented in C++
+
+ + + + + + + + + + + +
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
conditional_probability Namespace Reference
+
+
+ +

Functions for the Conditional Probability algorithm implementation. +More...

+

Detailed Description

+

Functions for the Conditional Probability algorithm implementation.

+
+
+ +
+ + + + diff --git a/dir_82e494173a87936756866de2fa774307.html b/dir_82e494173a87936756866de2fa774307.html index 15d4e37c1..d9ac270a8 100644 --- a/dir_82e494173a87936756866de2fa774307.html +++ b/dir_82e494173a87936756866de2fa774307.html @@ -146,6 +146,8 @@ Files  Bayes' theorem
 binomial_dist.cpp  Binomial distribution example
+
 conditional_probability.cpp + Conditional Probability
 exponential_dist.cpp  Exponential Distribution
 geometric_dist.cpp diff --git a/dir_82e494173a87936756866de2fa774307.js b/dir_82e494173a87936756866de2fa774307.js index a24721858..12f18c103 100644 --- a/dir_82e494173a87936756866de2fa774307.js +++ b/dir_82e494173a87936756866de2fa774307.js @@ -3,6 +3,7 @@ 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" ], + [ "conditional_probability.cpp", "d4/dd1/conditional__probability_8cpp.html", "d4/dd1/conditional__probability_8cpp" ], [ "exponential_dist.cpp", "d9/da2/exponential__dist_8cpp.html", "d9/da2/exponential__dist_8cpp" ], [ "geometric_dist.cpp", "de/d72/geometric__dist_8cpp.html", "de/d72/geometric__dist_8cpp" ], [ "poisson_dist.cpp", "d9/d24/poisson__dist_8cpp.html", "d9/d24/poisson__dist_8cpp" ], diff --git a/doxygen_crawl.html b/doxygen_crawl.html index b66cd48bd..449dc38f2 100644 --- a/doxygen_crawl.html +++ b/doxygen_crawl.html @@ -903,6 +903,11 @@ + + + + + @@ -3216,6 +3221,7 @@ + diff --git a/files.html b/files.html index b7595f477..e1048b6e4 100644 --- a/files.html +++ b/files.html @@ -457,90 +457,91 @@ N)\) time, with precision fixed using   
addition_rule.cppAddition rule of probabilities   
bayes_theorem.cppBayes' theorem   
binomial_dist.cppBinomial distribution example -  
exponential_dist.cppExponential Distribution -  
geometric_dist.cppGeometric Distribution -  
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 algorithm implementation -  
heavy_light_decomposition.cppHeavy Light Decomposition implementation -  
mo.cpp -  
persistent_seg_tree_lazy_prop.cppPersistent segment tree with range updates (lazy propagation) -  
prefix_sum_array.cppPrefix Sum Array data structure implementation -  
segtree.cppImplementation of [Segment Tree] (https://en.wikipedia.org/wiki/Segment_tree) data structure -  
sparse_table_range_queries.cpp - scripts -  
file_linter.py - search -  
binary_search.cpp -  
exponential_search.cppExponential search algorithm -  
fibonacci_search.cppFibonacci search algorithm -  
floyd_cycle_detection_algo.cppImplementation of Floyd's Cycle Detection algorithm -  
hash_search.cppHash Search Algorithm - Best Time Complexity Ω(1) -  
interpolation_search.cpp -  
interpolation_search2.cppInterpolation search algorithm -  
jump_search.cppC++ program to implement Jump Search -  
linear_search.cppLinear search algorithm -  
longest_increasing_subsequence_using_binary_search.cppFind the length of the Longest Increasing Subsequence (LIS) using Binary Search -  
median_search.cppImplementation of Median search algorithm. @cases from here -  
median_search2.cppGiven a linked list L[0,....,n] of n numbers, find the middle node -  
saddleback_search.cppImplementation of Saddleback Algorithm for 2D arrays -  
sublist_search.cppImplementation of the Sublist Search Algorithm -  
ternary_search.cppTernary search algorithm -  
text_search.cppSearch for words in a long textual paragraph - sorting -  
bead_sort.cpp -  
binary_insertion_sort.cppBinary Insertion Sort Algorithm (Insertion Sort) -  
bitonic_sort.cpp -  
bogo_sort.cppImplementation of Bogosort algorithm -  
bubble_sort.cppBubble sort algorithm -  
bucket_sort.cpp -  
cocktail_selection_sort.cpp -  
comb_sort.cppComb Sort Algorithm (Comb Sort) -  
count_inversions.cppCounting Inversions using Merge Sort -  
counting_sort.cpp -  
counting_sort_string.cpp -  
cycle_sort.cppImplementation of Cycle sort algorithm -  
dnf_sort.cppImplementation of the DNF sort implementation -  
gnome_sort.cppImplementation of gnome sort algorithm -  
heap_sort.cppHeap Sort Algorithm (heap sort) implementation -  
insertion_sort.cppInsertion Sort Algorithm (Insertion Sort) -  
insertion_sort_recursive.cppInsertion Sort Algorithm -  
library_sort.cpp -  
merge_insertion_sort.cppAlgorithm that combines insertion sort and merge sort. Wiki link -  
merge_sort.cppMerge Sort Algorithm (MERGE SORT) implementation -  
non_recursive_merge_sort.cpp -  
numeric_string_sort.cpp -  
odd_even_sort.cpp -  
pancake_sort.cppPancake sort sorts a disordered stack of pancakes by flipping any number of pancakes using a spatula using minimum number of flips -  
pigeonhole_sort.cppImplementation of [Pigeonhole Sort algorithm] (https://en.wikipedia.org/wiki/Pigeonhole_sort) -  
quick_sort.cppQuick sort implementation in C++ -  
quick_sort_3.cppImplementation Details -  
quick_sort_iterative.cppQuick Sort without recursion. This method uses the stack instead. Both recursive and iterative implementations have O(n log n) best case and O(n^2) worst case -  
radix_sort.cpp -  
radix_sort2.cppAlgorithm of Radix sort -  
random_pivot_quick_sort.cppImplementation of the Random Pivot Quick Sort algorithm -  
recursive_bubble_sort.cppThis is an implementation of a recursive version of the Bubble sort algorithm -  
selection_sort_iterative.cpp -  
selection_sort_recursive.cppImplementation of the Selection sort implementation using recursion -  
shell_sort.cpp -  
shell_sort2.cppShell sort algorithm -  
slow_sort.cpp -  
stooge_sort.cppStooge sort implementation in C++ -  
strand_sort.cppImplementation of Strand Sort algorithm -  
swap_sort.cpp -  
tim_sort.cpp -  
wave_sort.cppImplementation of the Wave sort algorithm -  
wiggle_sort.cpp[Wiggle Sort Algorithm] (https://leetcode.com/problems/wiggle-sort-ii/) Implementation - strings -  
boyer_moore.cppThe Boyer–Moore algorithm searches for occurrences of pattern P in text T by performing explicit character comparisons at different alignments. Instead of a brute-force search of all alignments (of which there are n - m + 1), Boyer–Moore uses information gained by preprocessing P to skip as many alignments as possible -  
brute_force_string_searching.cppString pattern search - brute force -  
duval.cppImplementation of Duval's algorithm -  
horspool.cppHorspool's algorithm that finds if a string contains a substring (https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore%E2%80%93Horspool_algorithm) -  
knuth_morris_pratt.cppThe Knuth-Morris-Pratt Algorithm for finding a pattern within a piece of text with complexity O(n + m) -  
manacher_algorithm.cppImplementation of Manacher's Algorithm -  
rabin_karp.cppThe Rabin-Karp Algorithm for finding a pattern within a piece of text with complexity O(n + m) -  
z_function.cppThe Z function for finding occurences of a pattern within a piece of text with time and space complexity O(n + m) +  
conditional_probability.cppConditional Probability +  
exponential_dist.cppExponential Distribution +  
geometric_dist.cppGeometric Distribution +  
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 algorithm implementation +  
heavy_light_decomposition.cppHeavy Light Decomposition implementation +  
mo.cpp +  
persistent_seg_tree_lazy_prop.cppPersistent segment tree with range updates (lazy propagation) +  
prefix_sum_array.cppPrefix Sum Array data structure implementation +  
segtree.cppImplementation of [Segment Tree] (https://en.wikipedia.org/wiki/Segment_tree) data structure +  
sparse_table_range_queries.cpp + scripts +  
file_linter.py + search +  
binary_search.cpp +  
exponential_search.cppExponential search algorithm +  
fibonacci_search.cppFibonacci search algorithm +  
floyd_cycle_detection_algo.cppImplementation of Floyd's Cycle Detection algorithm +  
hash_search.cppHash Search Algorithm - Best Time Complexity Ω(1) +  
interpolation_search.cpp +  
interpolation_search2.cppInterpolation search algorithm +  
jump_search.cppC++ program to implement Jump Search +  
linear_search.cppLinear search algorithm +  
longest_increasing_subsequence_using_binary_search.cppFind the length of the Longest Increasing Subsequence (LIS) using Binary Search +  
median_search.cppImplementation of Median search algorithm. @cases from here +  
median_search2.cppGiven a linked list L[0,....,n] of n numbers, find the middle node +  
saddleback_search.cppImplementation of Saddleback Algorithm for 2D arrays +  
sublist_search.cppImplementation of the Sublist Search Algorithm +  
ternary_search.cppTernary search algorithm +  
text_search.cppSearch for words in a long textual paragraph + sorting +  
bead_sort.cpp +  
binary_insertion_sort.cppBinary Insertion Sort Algorithm (Insertion Sort) +  
bitonic_sort.cpp +  
bogo_sort.cppImplementation of Bogosort algorithm +  
bubble_sort.cppBubble sort algorithm +  
bucket_sort.cpp +  
cocktail_selection_sort.cpp +  
comb_sort.cppComb Sort Algorithm (Comb Sort) +  
count_inversions.cppCounting Inversions using Merge Sort +  
counting_sort.cpp +  
counting_sort_string.cpp +  
cycle_sort.cppImplementation of Cycle sort algorithm +  
dnf_sort.cppImplementation of the DNF sort implementation +  
gnome_sort.cppImplementation of gnome sort algorithm +  
heap_sort.cppHeap Sort Algorithm (heap sort) implementation +  
insertion_sort.cppInsertion Sort Algorithm (Insertion Sort) +  
insertion_sort_recursive.cppInsertion Sort Algorithm +  
library_sort.cpp +  
merge_insertion_sort.cppAlgorithm that combines insertion sort and merge sort. Wiki link +  
merge_sort.cppMerge Sort Algorithm (MERGE SORT) implementation +  
non_recursive_merge_sort.cpp +  
numeric_string_sort.cpp +  
odd_even_sort.cpp +  
pancake_sort.cppPancake sort sorts a disordered stack of pancakes by flipping any number of pancakes using a spatula using minimum number of flips +  
pigeonhole_sort.cppImplementation of [Pigeonhole Sort algorithm] (https://en.wikipedia.org/wiki/Pigeonhole_sort) +  
quick_sort.cppQuick sort implementation in C++ +  
quick_sort_3.cppImplementation Details +  
quick_sort_iterative.cppQuick Sort without recursion. This method uses the stack instead. Both recursive and iterative implementations have O(n log n) best case and O(n^2) worst case +  
radix_sort.cpp +  
radix_sort2.cppAlgorithm of Radix sort +  
random_pivot_quick_sort.cppImplementation of the Random Pivot Quick Sort algorithm +  
recursive_bubble_sort.cppThis is an implementation of a recursive version of the Bubble sort algorithm +  
selection_sort_iterative.cpp +  
selection_sort_recursive.cppImplementation of the Selection sort implementation using recursion +  
shell_sort.cpp +  
shell_sort2.cppShell sort algorithm +  
slow_sort.cpp +  
stooge_sort.cppStooge sort implementation in C++ +  
strand_sort.cppImplementation of Strand Sort algorithm +  
swap_sort.cpp +  
tim_sort.cpp +  
wave_sort.cppImplementation of the Wave sort algorithm +  
wiggle_sort.cpp[Wiggle Sort Algorithm] (https://leetcode.com/problems/wiggle-sort-ii/) Implementation + strings +  
boyer_moore.cppThe Boyer–Moore algorithm searches for occurrences of pattern P in text T by performing explicit character comparisons at different alignments. Instead of a brute-force search of all alignments (of which there are n - m + 1), Boyer–Moore uses information gained by preprocessing P to skip as many alignments as possible +  
brute_force_string_searching.cppString pattern search - brute force +  
duval.cppImplementation of Duval's algorithm +  
horspool.cppHorspool's algorithm that finds if a string contains a substring (https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore%E2%80%93Horspool_algorithm) +  
knuth_morris_pratt.cppThe Knuth-Morris-Pratt Algorithm for finding a pattern within a piece of text with complexity O(n + m) +  
manacher_algorithm.cppImplementation of Manacher's Algorithm +  
rabin_karp.cppThe Rabin-Karp Algorithm for finding a pattern within a piece of text with complexity O(n + m) +  
z_function.cppThe Z function for finding occurences of a pattern within a piece of text with time and space complexity O(n + m) diff --git a/globals_func_m.html b/globals_func_m.html index 9e31dc1e6..dd89a69ed 100644 --- a/globals_func_m.html +++ b/globals_func_m.html @@ -139,7 +139,7 @@ document.addEventListener('DOMContentLoaded',() => { initNavTree('globals_func_m

- m -