diff --git a/d6/d84/namespaceutils.html b/d6/d84/namespaceutils.html
new file mode 100644
index 000000000..68faafb30
--- /dev/null
+++ b/d6/d84/namespaceutils.html
@@ -0,0 +1,125 @@
+
+
+
+
+
+
+
+Algorithms_in_C++: utils Namespace Reference
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Algorithms_in_C++ 1.0.0
+
+ Set of algorithms implemented in C++.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+
+
+
+
+
this namespace contains the definitions of the functions called from the class math::ncr_modulo_p::NCRModuloP
+More...
+
+
this namespace contains the definitions of the functions called from the class math::ncr_modulo_p::NCRModuloP
+
+
+
+
+
+
diff --git a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.html b/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.html
index 4b769dc4f..261a06419 100644
--- a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.html
+++ b/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.html
@@ -106,6 +106,7 @@ $(function(){initNavTree('d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.
-
-
-◆ fac
-
-
-
-
-
-
-
-
- std::vector <uint64_t> math::ncr_modulo_p::NCRModuloP::fac {}
-
-
-
-
-private
-
-
-
-
33 {};
+
computes nCr % p
+
Parameters
+
+ [in] n the number of objects to be chosen
+ [in] r the number of objects to choose from
+
+
+
+
Returns the value nCr % p
+
116 {
+
117
+
118 if (r > n) {
+
119 return 0;
+
120 }
+
121 if (r == 1) {
+
122 return n % p;
+
123 }
+
124 if (r == 0 || r == n) {
+
125 return 1;
+
126 }
+
127
+
128 const auto denominator = (
fac [r] *
fac [n - r]) % p;
+
129 const auto denominator_inv = utils::modInverse(denominator, p);
+
130 if (denominator_inv < 0) {
+
131 return -1;
+
132 }
+
133 return (
fac [n] * denominator_inv) % p;
+
134 }
diff --git a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.js b/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.js
index a761f61e0..f2b3aa309 100644
--- a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.js
+++ b/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.js
@@ -1,8 +1,7 @@
var classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p =
[
- [ "NCRModuloP", "d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.html#af3d41271912f9fa50b774c96c51874b9", null ],
- [ "gcdExtended", "d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.html#afde201f4687740454302c444f507a926", null ],
- [ "modInverse", "d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.html#a0431ec5c876e1154d8e1e5f89e1ab34a", null ],
- [ "ncr", "d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.html#a6b95277f5f527beacc8d0f3bc91fcd08", null ],
- [ "p", "d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.html#a57c168cd6eb85718eab97da658a698ad", null ]
+ [ "NCRModuloP", "d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.html#a94b07e7dc61d8d7a1e9c5a28988e72f9", null ],
+ [ "computeFactorialsMod", "d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.html#ab5744fa589f6a48f9fe7bca13dbe661f", null ],
+ [ "ncr", "d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.html#a499df7a01bcd348345dc5a0ab79bb0e9", null ],
+ [ "fac", "d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.html#a738a5f59bb3560c81cdb7f43bcfe9fec", null ]
];
\ No newline at end of file
diff --git a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a0431ec5c876e1154d8e1e5f89e1ab34a_cgraph.map b/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a0431ec5c876e1154d8e1e5f89e1ab34a_cgraph.map
deleted file mode 100644
index 3f6f101ac..000000000
--- a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a0431ec5c876e1154d8e1e5f89e1ab34a_cgraph.map
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a0431ec5c876e1154d8e1e5f89e1ab34a_cgraph.md5 b/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a0431ec5c876e1154d8e1e5f89e1ab34a_cgraph.md5
deleted file mode 100644
index 1507d2f65..000000000
--- a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a0431ec5c876e1154d8e1e5f89e1ab34a_cgraph.md5
+++ /dev/null
@@ -1 +0,0 @@
-f06cc14bf3912fe369d70a4a9a0413b6
\ No newline at end of file
diff --git a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a0431ec5c876e1154d8e1e5f89e1ab34a_cgraph_org.svg b/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a0431ec5c876e1154d8e1e5f89e1ab34a_cgraph_org.svg
deleted file mode 100644
index 9a1091e9b..000000000
--- a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a0431ec5c876e1154d8e1e5f89e1ab34a_cgraph_org.svg
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
-
-
-
-math::ncr_modulo_p::NCRModuloP::modInverse
-
-
-Node1
-
-
-math::ncr_modulo_p
-::NCRModuloP::modInverse
-
-
-
-
-
-Node2
-
-
-math::ncr_modulo_p
-::NCRModuloP::gcdExtended
-
-
-
-
-
-Node1->Node2
-
-
-
-
-
-
-
-
-Node2->Node2
-
-
-
-
-
-
-
-
-Node3
-
-
-gcd
-
-
-
-
-
-Node2->Node3
-
-
-
-
-
-
-
-
diff --git a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a6b95277f5f527beacc8d0f3bc91fcd08_cgraph.map b/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a6b95277f5f527beacc8d0f3bc91fcd08_cgraph.map
deleted file mode 100644
index 546da1263..000000000
--- a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a6b95277f5f527beacc8d0f3bc91fcd08_cgraph.map
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a6b95277f5f527beacc8d0f3bc91fcd08_cgraph.md5 b/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a6b95277f5f527beacc8d0f3bc91fcd08_cgraph.md5
deleted file mode 100644
index c6ee41c07..000000000
--- a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a6b95277f5f527beacc8d0f3bc91fcd08_cgraph.md5
+++ /dev/null
@@ -1 +0,0 @@
-f639372407ee0f37245df2e372d826c1
\ No newline at end of file
diff --git a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a6b95277f5f527beacc8d0f3bc91fcd08_cgraph.svg b/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a6b95277f5f527beacc8d0f3bc91fcd08_cgraph.svg
deleted file mode 100644
index 9b530e5be..000000000
--- a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a6b95277f5f527beacc8d0f3bc91fcd08_cgraph.svg
+++ /dev/null
@@ -1,170 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-math::ncr_modulo_p::NCRModuloP::ncr
-
-
-Node1
-
-
-math::ncr_modulo_p
-::NCRModuloP::ncr
-
-
-
-
-
-Node2
-
-
-math::ncr_modulo_p
-::NCRModuloP::modInverse
-
-
-
-
-
-Node1->Node2
-
-
-
-
-
-
-
-
-Node3
-
-
-math::ncr_modulo_p
-::NCRModuloP::gcdExtended
-
-
-
-
-
-Node2->Node3
-
-
-
-
-
-
-
-
-Node3->Node3
-
-
-
-
-
-
-
-
-Node4
-
-
-gcd
-
-
-
-
-
-Node3->Node4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a6b95277f5f527beacc8d0f3bc91fcd08_cgraph_org.svg b/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a6b95277f5f527beacc8d0f3bc91fcd08_cgraph_org.svg
deleted file mode 100644
index f46353727..000000000
--- a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a6b95277f5f527beacc8d0f3bc91fcd08_cgraph_org.svg
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
-
-
-
-math::ncr_modulo_p::NCRModuloP::ncr
-
-
-Node1
-
-
-math::ncr_modulo_p
-::NCRModuloP::ncr
-
-
-
-
-
-Node2
-
-
-math::ncr_modulo_p
-::NCRModuloP::modInverse
-
-
-
-
-
-Node1->Node2
-
-
-
-
-
-
-
-
-Node3
-
-
-math::ncr_modulo_p
-::NCRModuloP::gcdExtended
-
-
-
-
-
-Node2->Node3
-
-
-
-
-
-
-
-
-Node3->Node3
-
-
-
-
-
-
-
-
-Node4
-
-
-gcd
-
-
-
-
-
-Node3->Node4
-
-
-
-
-
-
-
-
diff --git a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_afde201f4687740454302c444f507a926_cgraph.map b/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_afde201f4687740454302c444f507a926_cgraph.map
deleted file mode 100644
index 00d91d0c4..000000000
--- a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_afde201f4687740454302c444f507a926_cgraph.map
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_afde201f4687740454302c444f507a926_cgraph.md5 b/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_afde201f4687740454302c444f507a926_cgraph.md5
deleted file mode 100644
index 6ad9f0f22..000000000
--- a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_afde201f4687740454302c444f507a926_cgraph.md5
+++ /dev/null
@@ -1 +0,0 @@
-36d1c5e8e42c63e54f30e372c1a629bd
\ No newline at end of file
diff --git a/db/d66/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p__coll__graph.map b/db/d66/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p__coll__graph.map
index 8f081dd30..9fe7ce4e4 100644
--- a/db/d66/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p__coll__graph.map
+++ b/db/d66/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p__coll__graph.map
@@ -1,7 +1,7 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/db/d66/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p__coll__graph.md5 b/db/d66/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p__coll__graph.md5
index 0ca6c7de3..dd23966a2 100644
--- a/db/d66/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p__coll__graph.md5
+++ b/db/d66/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p__coll__graph.md5
@@ -1 +1 @@
-7507f17b72c8027fffdd536f1bb9971d
\ No newline at end of file
+a4f915c326bfb68f957e0df8cc1226e7
\ No newline at end of file
diff --git a/db/d66/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p__coll__graph.svg b/db/d66/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p__coll__graph.svg
index 745b32791..7a8694e69 100644
--- a/db/d66/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p__coll__graph.svg
+++ b/db/d66/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p__coll__graph.svg
@@ -4,8 +4,8 @@
-
+
@@ -23,9 +23,9 @@
Node1
-
-math::ncr_modulo_p
-::NCRModuloP
+
+math::ncr_modulo_p
+::NCRModuloP
@@ -33,8 +33,8 @@
Node2
-
-std::vector< uint64_t >
+
+std::vector< int64_t >
@@ -42,18 +42,18 @@
Node2->Node1
-
-
+
+
- fac
+ fac
Node3
-
-std::uint64_t
+
+std::int64_t
@@ -61,11 +61,11 @@
Node3->Node2
-
-
+
+
- elements
+ elements
diff --git a/db/d66/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p__coll__graph_org.svg b/db/d66/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p__coll__graph_org.svg
index a3315580a..0354b605d 100644
--- a/db/d66/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p__coll__graph_org.svg
+++ b/db/d66/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p__coll__graph_org.svg
@@ -4,17 +4,17 @@
-
+
math::ncr_modulo_p::NCRModuloP
Node1
-
-math::ncr_modulo_p
-::NCRModuloP
+
+math::ncr_modulo_p
+::NCRModuloP
@@ -22,8 +22,8 @@
Node2
-
-std::vector< uint64_t >
+
+std::vector< int64_t >
@@ -31,18 +31,18 @@
Node2->Node1
-
-
+
+
- fac
+ fac
Node3
-
-std::uint64_t
+
+std::int64_t
@@ -50,11 +50,11 @@
Node3->Node2
-
-
+
+
- elements
+ elements
diff --git a/dd/d47/namespacemath.html b/dd/d47/namespacemath.html
index 267507b7b..14be483a1 100644
--- a/dd/d47/namespacemath.html
+++ b/dd/d47/namespacemath.html
@@ -313,8 +313,6 @@ Algorithm
Mathematical algorithms
for assert for std::cout
Mathematical algorithms
-for assert for io operations
-Mathematical algorithms
for assert for M_PI definition and pow() for uint16_t datatype
Mathematical algorithms
std::array assert std::sqrt , std::trunc , std::pow std::complex std::invalid_argument std::setprecision
diff --git a/de/d1e/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p-members.html b/de/d1e/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p-members.html
index ee5155729..a26288082 100644
--- a/de/d1e/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p-members.html
+++ b/de/d1e/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p-members.html
@@ -110,12 +110,11 @@ $(function(){initNavTree('d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.
This is the complete list of members for math::ncr_modulo_p::NCRModuloP , including all inherited members.
- fac (defined in math::ncr_modulo_p::NCRModuloP )math::ncr_modulo_p::NCRModuloP private
- gcdExtended (const uint64_t &a, const uint64_t &b, int64_t *x, int64_t *y)math::ncr_modulo_p::NCRModuloP inline
- modInverse (const uint64_t &a, const uint64_t &m)math::ncr_modulo_p::NCRModuloP inline
- ncr (const uint64_t &n, const uint64_t &r, const uint64_t &p)math::ncr_modulo_p::NCRModuloP inline
- NCRModuloP (const uint64_t &size, const uint64_t &mod)math::ncr_modulo_p::NCRModuloP inline
- p math::ncr_modulo_p::NCRModuloP private
+ computeFactorialsMod (const int64_t &max_arg_val, const int64_t &mod)math::ncr_modulo_p::NCRModuloP inline private static
+ fac math::ncr_modulo_p::NCRModuloP private
+ ncr (const int64_t &n, const int64_t &r) constmath::ncr_modulo_p::NCRModuloP inline
+ NCRModuloP (const int64_t &size, const int64_t &p)math::ncr_modulo_p::NCRModuloP inline
+ p (defined in math::ncr_modulo_p::NCRModuloP )math::ncr_modulo_p::NCRModuloP private
diff --git a/de/dab/ncr__modulo__p_8cpp.html b/de/dab/ncr__modulo__p_8cpp.html
index 9daa9e4d7..a4096c83d 100644
--- a/de/dab/ncr__modulo__p_8cpp.html
+++ b/de/dab/ncr__modulo__p_8cpp.html
@@ -137,20 +137,130 @@ Namespaces
namespace ncr_modulo_p
Functions for nCr modulo p implementation.
+namespace utils
+ this namespace contains the definitions of the functions called from the class math::ncr_modulo_p::NCRModuloP
+
This program aims at calculating nCr modulo p .
nCr is defined as n! / (r! * (n-r)!) where n! represents factorial of n. In many cases, the value of nCr is too large to fit in a 64 bit integer. Hence, in competitive programming, there are many problems or subproblems to compute nCr modulo p where p is a given number.
Author Kaustubh Damania
+
+◆ example()
+
+
+
+
+
+ void example
+ (
+ )
+
+
+
+
+
+
example showing the usage of the math::ncr_modulo_p::NCRModuloP class
+
175 {
+
176 const int64_t size = 1e6 + 1;
+
177 const int64_t p = 1e9 + 7;
+
178
+
179
+
180
+
+
182
+
183
+
184
+
185 for (int i = 0; i <= 7; i++) {
+
186 std::cout << 6 <<
"C" << i <<
" mod " << p <<
" = " << ncrObj.ncr(6, i)
+
187 << "\n" ;
+
188 }
+
189 }
+
+
Class which contains all methods required for calculating nCr mod p.
Definition ncr_modulo_p.cpp:79
+
+
+
+
+◆ gcdExtended()
+
+
+
+
+
+ int64_t math::ncr_modulo_p::utils::gcdExtended
+ (
+ const int64_t & a ,
+
+
+
+
+ const int64_t & b ,
+
+
+
+
+ int64_t & x ,
+
+
+
+
+ int64_t & y )
+
+
+
+
+
finds the values x and y such that a*x + b*y = gcd(a,b)
+
Parameters
+
+ [in] a the first input of the gcd
+ [in] a the second input of the gcd
+ [out] x the Bézout coefficient of a
+ [out] y the Bézout coefficient of b
+
+
+
+
Returns the gcd of a and b
+
45 {
+
46 if (a == 0) {
+
47 x = 0;
+
48 y = 1;
+
49 return b;
+
50 }
+
51
+
52 int64_t x1 = 0, y1 = 0;
+
+
54
+
55 x = y1 - (b / a) * x1;
+
56 y = x1;
+
+
58 }
+
int gcd(int num1, int num2)
Definition gcd_iterative_euclidean.cpp:15
+
int64_t gcdExtended(const int64_t &a, const int64_t &b, int64_t &x, int64_t &y)
finds the values x and y such that a*x + b*y = gcd(a,b)
Definition ncr_modulo_p.cpp:44
+
+
+
+
+
◆ main()
@@ -165,37 +275,63 @@ Functions
+
191 {
+
+
+
194 return 0;
+
195 }
+
static void tests()
tests math::ncr_modulo_p::NCRModuloP
Definition ncr_modulo_p.cpp:142
+
void example()
example showing the usage of the math::ncr_modulo_p::NCRModuloP class
Definition ncr_modulo_p.cpp:175
+
+
+
+
+◆ modInverse()
-Main function.
-Returns 0 on exit
- 137 {
-
138
-
139 const uint64_t size = 1e6 + 1;
-
140 const uint64_t p = 1e9 + 7;
-
-
-
143
-
144 for (int i = 0; i <= 7; i++) {
-
145 std::cout << 6 <<
"C" << i <<
" = " << ncrObj.
ncr (6, i, p) <<
"\n" ;
-
146 }
-
-
-
149 return 0;
-
150 }
-
-
Class which contains all methods required for calculating nCr mod p.
Definition ncr_modulo_p.cpp:31
-
int64_t ncr(const uint64_t &n, const uint64_t &r, const uint64_t &p)
Definition ncr_modulo_p.cpp:92
-
Testcases to check Union of Two Arrays.
+
+
+
+
+ int64_t math::ncr_modulo_p::utils::modInverse
+ (
+ const int64_t & a ,
+
+
+
+
+ const int64_t & m )
+
+
+
+
Find modular inverse of a modulo m i.e. a number x such that (a*x)m = 1
+
Parameters
+
+ [in] a the number for which the modular inverse is queried
+ [in] m the modulus
+
+
+
+
Returns the inverce of a modulo m, if it exists, -1 otherwise
+
66 {
+
67 int64_t x = 0, y = 0;
+
+
69 if (g != 1) {
+
70 return -1;
+
71 } else {
+
72 return ((x + m) % m);
+
73 }
+
74 }
+
double g(double x)
Another test function.
Definition composite_simpson_rule.cpp:115
-
-
◆ tests()
+
+
◆ tests()
@@ -206,7 +342,7 @@ Here is the call graph for this function:
static void tests
(
- math::ncr_modulo_p::NCRModuloP ncrObj )
+ )
@@ -217,26 +353,43 @@ Here is the call graph for this function:
-
Test implementations.
-
Parameters
-
- ncrObj object which contains the precomputed factorial values and ncr function
-
-
-
-
Returns void
-
124 {
-
125
-
126 assert(ncrObj.
ncr (52323, 26161, 1000000007) == 224944353);
-
127
-
128 assert(ncrObj.
ncr (6, 2, 5) == 0);
-
129
-
130 assert(ncrObj.
ncr (7, 3, 29) == 6);
-
131 }
+
tests math::ncr_modulo_p::NCRModuloP
+
142 {
+
+
144 const int64_t size;
+
145 const int64_t p;
+
146 const int64_t n;
+
147 const int64_t r;
+
148 const int64_t expected;
+
149
+
150 TestCase (
const int64_t size,
const int64_t p,
const int64_t n,
+
151 const int64_t r, const int64_t expected)
+
152 : size(size), p(p), n(n), r(r), expected(expected) {}
+
153 };
+
+
155 TestCase (60000, 1000000007, 52323, 26161, 224944353),
+
+
+
158 TestCase (1000, 13, 10, 3, 120 % 13),
+
+
+
+
+
+
164 for (const auto & tc : test_cases) {
+
+
166 tc.expected);
+
167 }
+
168
+
169 std::cout <<
"\n\nAll tests have successfully passed!\n" ;
+
170 }
+
int64_t ncr(const int64_t &n, const int64_t &r) const
computes nCr % p
Definition ncr_modulo_p.cpp:116
+
represents single example inputs and expected output of the function longest_common_string_length
Definition longest_common_string.cpp:54
+
diff --git a/de/dab/ncr__modulo__p_8cpp.js b/de/dab/ncr__modulo__p_8cpp.js
index d539e73f3..812411e71 100644
--- a/de/dab/ncr__modulo__p_8cpp.js
+++ b/de/dab/ncr__modulo__p_8cpp.js
@@ -1,6 +1,8 @@
var ncr__modulo__p_8cpp =
[
[ "math::ncr_modulo_p::NCRModuloP", "d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p.html", "d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p" ],
- [ "main", "de/dab/ncr__modulo__p_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ],
- [ "tests", "de/dab/ncr__modulo__p_8cpp.html#af0a3e6827f41c151e47451f5ff98b1f1", null ]
+ [ "example", "de/dab/ncr__modulo__p_8cpp.html#afa2b50f4716fc3b42221a72e676e1422", null ],
+ [ "gcdExtended", "de/dab/ncr__modulo__p_8cpp.html#a9010ad5669d31449c3bf3271ab5ebc86", null ],
+ [ "modInverse", "de/dab/ncr__modulo__p_8cpp.html#a6c7bfe3bdaa086d32261a5c5584d0fa9", null ],
+ [ "tests", "de/dab/ncr__modulo__p_8cpp.html#a483bb8ccf42aaf7375a83e91490eda1e", null ]
];
\ No newline at end of file
diff --git a/de/dab/ncr__modulo__p_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.map b/de/dab/ncr__modulo__p_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.map
new file mode 100644
index 000000000..f41266ef4
--- /dev/null
+++ b/de/dab/ncr__modulo__p_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.map
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/de/dab/ncr__modulo__p_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.md5 b/de/dab/ncr__modulo__p_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.md5
new file mode 100644
index 000000000..bd2141301
--- /dev/null
+++ b/de/dab/ncr__modulo__p_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.md5
@@ -0,0 +1 @@
+ec67b7f0511b8bc24ff7b08d968d95ab
\ No newline at end of file
diff --git a/de/dab/ncr__modulo__p_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.svg b/de/dab/ncr__modulo__p_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.svg
new file mode 100644
index 000000000..8852bcb7b
--- /dev/null
+++ b/de/dab/ncr__modulo__p_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.svg
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+tests
+
+
+Node1
+
+
+tests
+
+
+
+
+
+Node2
+
+
+math::ncr_modulo_p
+::NCRModuloP::ncr
+
+
+
+
+
+Node1->Node2
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/de/dab/ncr__modulo__p_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph_org.svg b/de/dab/ncr__modulo__p_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph_org.svg
new file mode 100644
index 000000000..8326290db
--- /dev/null
+++ b/de/dab/ncr__modulo__p_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph_org.svg
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+tests
+
+
+Node1
+
+
+tests
+
+
+
+
+
+Node2
+
+
+math::ncr_modulo_p
+::NCRModuloP::ncr
+
+
+
+
+
+Node1->Node2
+
+
+
+
+
+
+
+
diff --git a/de/dab/ncr__modulo__p_8cpp_a6c7bfe3bdaa086d32261a5c5584d0fa9_cgraph.map b/de/dab/ncr__modulo__p_8cpp_a6c7bfe3bdaa086d32261a5c5584d0fa9_cgraph.map
new file mode 100644
index 000000000..8dfe7ecf7
--- /dev/null
+++ b/de/dab/ncr__modulo__p_8cpp_a6c7bfe3bdaa086d32261a5c5584d0fa9_cgraph.map
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/de/dab/ncr__modulo__p_8cpp_a6c7bfe3bdaa086d32261a5c5584d0fa9_cgraph.md5 b/de/dab/ncr__modulo__p_8cpp_a6c7bfe3bdaa086d32261a5c5584d0fa9_cgraph.md5
new file mode 100644
index 000000000..5cb077109
--- /dev/null
+++ b/de/dab/ncr__modulo__p_8cpp_a6c7bfe3bdaa086d32261a5c5584d0fa9_cgraph.md5
@@ -0,0 +1 @@
+1a4f0a265ffd31483084966d366feec6
\ No newline at end of file
diff --git a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a0431ec5c876e1154d8e1e5f89e1ab34a_cgraph.svg b/de/dab/ncr__modulo__p_8cpp_a6c7bfe3bdaa086d32261a5c5584d0fa9_cgraph.svg
similarity index 50%
rename from d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a0431ec5c876e1154d8e1e5f89e1ab34a_cgraph.svg
rename to de/dab/ncr__modulo__p_8cpp_a6c7bfe3bdaa086d32261a5c5584d0fa9_cgraph.svg
index 9b87952d7..7139cdcfe 100644
--- a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_a0431ec5c876e1154d8e1e5f89e1ab34a_cgraph.svg
+++ b/de/dab/ncr__modulo__p_8cpp_a6c7bfe3bdaa086d32261a5c5584d0fa9_cgraph.svg
@@ -3,9 +3,9 @@
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-
-
+
+
@@ -18,24 +18,33 @@
-math::ncr_modulo_p::NCRModuloP::modInverse
+math::ncr_modulo_p::utils::modInverse
Node1
-
+
math::ncr_modulo_p
-::NCRModuloP::modInverse
+::utils::modInverse
+
+
+
+
+
+Node1->Node1
+
+
+
Node2
-
-
-math::ncr_modulo_p
-::NCRModuloP::gcdExtended
+
+
+math::ncr_modulo_p
+::utils::gcdExtended
@@ -43,8 +52,8 @@
Node1->Node2
-
-
+
+
@@ -52,8 +61,8 @@
Node2->Node2
-
-
+
+
@@ -61,8 +70,8 @@
Node3
-
-gcd
+
+gcd
@@ -70,8 +79,8 @@
Node2->Node3
-
-
+
+
diff --git a/de/dab/ncr__modulo__p_8cpp_a6c7bfe3bdaa086d32261a5c5584d0fa9_cgraph_org.svg b/de/dab/ncr__modulo__p_8cpp_a6c7bfe3bdaa086d32261a5c5584d0fa9_cgraph_org.svg
new file mode 100644
index 000000000..49119a3ae
--- /dev/null
+++ b/de/dab/ncr__modulo__p_8cpp_a6c7bfe3bdaa086d32261a5c5584d0fa9_cgraph_org.svg
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+math::ncr_modulo_p::utils::modInverse
+
+
+Node1
+
+
+math::ncr_modulo_p
+::utils::modInverse
+
+
+
+
+
+Node1->Node1
+
+
+
+
+
+
+
+
+Node2
+
+
+math::ncr_modulo_p
+::utils::gcdExtended
+
+
+
+
+
+Node1->Node2
+
+
+
+
+
+
+
+
+Node2->Node2
+
+
+
+
+
+
+
+
+Node3
+
+
+gcd
+
+
+
+
+
+Node2->Node3
+
+
+
+
+
+
+
+
diff --git a/de/dab/ncr__modulo__p_8cpp_a9010ad5669d31449c3bf3271ab5ebc86_cgraph.map b/de/dab/ncr__modulo__p_8cpp_a9010ad5669d31449c3bf3271ab5ebc86_cgraph.map
new file mode 100644
index 000000000..9c74eae12
--- /dev/null
+++ b/de/dab/ncr__modulo__p_8cpp_a9010ad5669d31449c3bf3271ab5ebc86_cgraph.map
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/de/dab/ncr__modulo__p_8cpp_a9010ad5669d31449c3bf3271ab5ebc86_cgraph.md5 b/de/dab/ncr__modulo__p_8cpp_a9010ad5669d31449c3bf3271ab5ebc86_cgraph.md5
new file mode 100644
index 000000000..b8480c416
--- /dev/null
+++ b/de/dab/ncr__modulo__p_8cpp_a9010ad5669d31449c3bf3271ab5ebc86_cgraph.md5
@@ -0,0 +1 @@
+ba3da75994498c1bdb1f6cc36a33fadf
\ No newline at end of file
diff --git a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_afde201f4687740454302c444f507a926_cgraph.svg b/de/dab/ncr__modulo__p_8cpp_a9010ad5669d31449c3bf3271ab5ebc86_cgraph.svg
similarity index 63%
rename from d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_afde201f4687740454302c444f507a926_cgraph.svg
rename to de/dab/ncr__modulo__p_8cpp_a9010ad5669d31449c3bf3271ab5ebc86_cgraph.svg
index 9cbcc2f00..b2392fada 100644
--- a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_afde201f4687740454302c444f507a926_cgraph.svg
+++ b/de/dab/ncr__modulo__p_8cpp_a9010ad5669d31449c3bf3271ab5ebc86_cgraph.svg
@@ -3,9 +3,9 @@
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-
-
+
+
@@ -18,14 +18,14 @@
-math::ncr_modulo_p::NCRModuloP::gcdExtended
+math::ncr_modulo_p::utils::gcdExtended
Node1
-
-
+
+
math::ncr_modulo_p
-::NCRModuloP::gcdExtended
+::utils::gcdExtended
@@ -33,8 +33,8 @@
Node1->Node1
-
-
+
+
@@ -42,8 +42,8 @@
Node2
-
-gcd
+
+gcd
@@ -51,8 +51,8 @@
Node1->Node2
-
-
+
+
diff --git a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_afde201f4687740454302c444f507a926_cgraph_org.svg b/de/dab/ncr__modulo__p_8cpp_a9010ad5669d31449c3bf3271ab5ebc86_cgraph_org.svg
similarity index 51%
rename from d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_afde201f4687740454302c444f507a926_cgraph_org.svg
rename to de/dab/ncr__modulo__p_8cpp_a9010ad5669d31449c3bf3271ab5ebc86_cgraph_org.svg
index 7d82111f8..b1d911018 100644
--- a/d6/dc1/classmath_1_1ncr__modulo__p_1_1_n_c_r_modulo_p_afde201f4687740454302c444f507a926_cgraph_org.svg
+++ b/de/dab/ncr__modulo__p_8cpp_a9010ad5669d31449c3bf3271ab5ebc86_cgraph_org.svg
@@ -3,18 +3,18 @@
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-
-
+
+
-math::ncr_modulo_p::NCRModuloP::gcdExtended
+math::ncr_modulo_p::utils::gcdExtended
Node1
-
-
+
+
math::ncr_modulo_p
-::NCRModuloP::gcdExtended
+::utils::gcdExtended
@@ -22,8 +22,8 @@
Node1->Node1
-
-
+
+
@@ -31,8 +31,8 @@
Node2
-
-gcd
+
+gcd
@@ -40,8 +40,8 @@
Node1->Node2
-
-
+
+
diff --git a/de/dab/ncr__modulo__p_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/de/dab/ncr__modulo__p_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map
deleted file mode 100644
index fee44b9b0..000000000
--- a/de/dab/ncr__modulo__p_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/de/dab/ncr__modulo__p_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/de/dab/ncr__modulo__p_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5
deleted file mode 100644
index 7ff52b0cb..000000000
--- a/de/dab/ncr__modulo__p_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5
+++ /dev/null
@@ -1 +0,0 @@
-afda47681566cb929ac8335b91ba8353
\ No newline at end of file
diff --git a/de/dab/ncr__modulo__p_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/de/dab/ncr__modulo__p_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg
deleted file mode 100644
index 061207347..000000000
--- a/de/dab/ncr__modulo__p_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg
+++ /dev/null
@@ -1,188 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-main
-
-
-Node1
-
-
-main
-
-
-
-
-
-Node2
-
-
-math::ncr_modulo_p
-::NCRModuloP::ncr
-
-
-
-
-
-Node1->Node2
-
-
-
-
-
-
-
-
-Node3
-
-
-math::ncr_modulo_p
-::NCRModuloP::modInverse
-
-
-
-
-
-Node2->Node3
-
-
-
-
-
-
-
-
-Node4
-
-
-math::ncr_modulo_p
-::NCRModuloP::gcdExtended
-
-
-
-
-
-Node3->Node4
-
-
-
-
-
-
-
-
-Node4->Node4
-
-
-
-
-
-
-
-
-Node5
-
-
-gcd
-
-
-
-
-
-Node4->Node5
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/de/dab/ncr__modulo__p_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg b/de/dab/ncr__modulo__p_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg
deleted file mode 100644
index 026838667..000000000
--- a/de/dab/ncr__modulo__p_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg
+++ /dev/null
@@ -1,105 +0,0 @@
-
-
-
-
-
-
-main
-
-
-Node1
-
-
-main
-
-
-
-
-
-Node2
-
-
-math::ncr_modulo_p
-::NCRModuloP::ncr
-
-
-
-
-
-Node1->Node2
-
-
-
-
-
-
-
-
-Node3
-
-
-math::ncr_modulo_p
-::NCRModuloP::modInverse
-
-
-
-
-
-Node2->Node3
-
-
-
-
-
-
-
-
-Node4
-
-
-math::ncr_modulo_p
-::NCRModuloP::gcdExtended
-
-
-
-
-
-Node3->Node4
-
-
-
-
-
-
-
-
-Node4->Node4
-
-
-
-
-
-
-
-
-Node5
-
-
-gcd
-
-
-
-
-
-Node4->Node5
-
-
-
-
-
-
-
-
diff --git a/de/dab/ncr__modulo__p_8cpp_af0a3e6827f41c151e47451f5ff98b1f1_cgraph.map b/de/dab/ncr__modulo__p_8cpp_af0a3e6827f41c151e47451f5ff98b1f1_cgraph.map
deleted file mode 100644
index 8a7982dcb..000000000
--- a/de/dab/ncr__modulo__p_8cpp_af0a3e6827f41c151e47451f5ff98b1f1_cgraph.map
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/de/dab/ncr__modulo__p_8cpp_af0a3e6827f41c151e47451f5ff98b1f1_cgraph.md5 b/de/dab/ncr__modulo__p_8cpp_af0a3e6827f41c151e47451f5ff98b1f1_cgraph.md5
deleted file mode 100644
index 42c565649..000000000
--- a/de/dab/ncr__modulo__p_8cpp_af0a3e6827f41c151e47451f5ff98b1f1_cgraph.md5
+++ /dev/null
@@ -1 +0,0 @@
-2cc016bbb48cae071e8a751a9517bc3b
\ No newline at end of file
diff --git a/de/dab/ncr__modulo__p_8cpp_af0a3e6827f41c151e47451f5ff98b1f1_cgraph.svg b/de/dab/ncr__modulo__p_8cpp_af0a3e6827f41c151e47451f5ff98b1f1_cgraph.svg
deleted file mode 100644
index b2ebe0ad4..000000000
--- a/de/dab/ncr__modulo__p_8cpp_af0a3e6827f41c151e47451f5ff98b1f1_cgraph.svg
+++ /dev/null
@@ -1,188 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-tests
-
-
-Node1
-
-
-tests
-
-
-
-
-
-Node2
-
-
-math::ncr_modulo_p
-::NCRModuloP::ncr
-
-
-
-
-
-Node1->Node2
-
-
-
-
-
-
-
-
-Node3
-
-
-math::ncr_modulo_p
-::NCRModuloP::modInverse
-
-
-
-
-
-Node2->Node3
-
-
-
-
-
-
-
-
-Node4
-
-
-math::ncr_modulo_p
-::NCRModuloP::gcdExtended
-
-
-
-
-
-Node3->Node4
-
-
-
-
-
-
-
-
-Node4->Node4
-
-
-
-
-
-
-
-
-Node5
-
-
-gcd
-
-
-
-
-
-Node4->Node5
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/de/dab/ncr__modulo__p_8cpp_af0a3e6827f41c151e47451f5ff98b1f1_cgraph_org.svg b/de/dab/ncr__modulo__p_8cpp_af0a3e6827f41c151e47451f5ff98b1f1_cgraph_org.svg
deleted file mode 100644
index 63c5b5f7a..000000000
--- a/de/dab/ncr__modulo__p_8cpp_af0a3e6827f41c151e47451f5ff98b1f1_cgraph_org.svg
+++ /dev/null
@@ -1,105 +0,0 @@
-
-
-
-
-
-
-tests
-
-
-Node1
-
-
-tests
-
-
-
-
-
-Node2
-
-
-math::ncr_modulo_p
-::NCRModuloP::ncr
-
-
-
-
-
-Node1->Node2
-
-
-
-
-
-
-
-
-Node3
-
-
-math::ncr_modulo_p
-::NCRModuloP::modInverse
-
-
-
-
-
-Node2->Node3
-
-
-
-
-
-
-
-
-Node4
-
-
-math::ncr_modulo_p
-::NCRModuloP::gcdExtended
-
-
-
-
-
-Node3->Node4
-
-
-
-
-
-
-
-
-Node4->Node4
-
-
-
-
-
-
-
-
-Node5
-
-
-gcd
-
-
-
-
-
-Node4->Node5
-
-
-
-
-
-
-
-
diff --git a/doxygen_crawl.html b/doxygen_crawl.html
index 2628f7c5e..78c8d5e7f 100644
--- a/doxygen_crawl.html
+++ b/doxygen_crawl.html
@@ -669,6 +669,7 @@
+
@@ -2130,6 +2131,7 @@
+
@@ -2162,11 +2164,10 @@
-
-
-
-
-
+
+
+
+
@@ -2676,6 +2677,8 @@
+
+
@@ -3696,8 +3699,10 @@
-
-
+
+
+
+
diff --git a/functions_c.html b/functions_c.html
index fe2bd34c3..8687a0a0a 100644
--- a/functions_c.html
+++ b/functions_c.html
@@ -122,6 +122,7 @@ $(function(){initNavTree('functions_c.html',''); initResizable(true); });
comb() : data_structures::SegmentTree< T >
combine() : range_queries::heavy_light_decomposition::SG< X >
Complex() : Complex
+computeFactorialsMod() : math::ncr_modulo_p::NCRModuloP
construct() : range_queries::perSegTree
Contains() : data_structures::tree_234::Node
contains() : binary_search_tree< T > , data_structures::Bitset , data_structures::BloomFilter< T >
diff --git a/functions_f.html b/functions_f.html
index 3255af9b0..2bcee1022 100644
--- a/functions_f.html
+++ b/functions_f.html
@@ -107,6 +107,7 @@ $(function(){initNavTree('functions_f.html',''); initResizable(true); });
Here is a list of all documented class members with links to the class documentation for each member:
- f -
diff --git a/functions_func_n.html b/functions_func_n.html
index 41b98adf8..5b9094ba0 100644
--- a/functions_func_n.html
+++ b/functions_func_n.html
@@ -108,8 +108,8 @@ $(function(){initNavTree('functions_func_n.html',''); initResizable(true); });
- n -