Skip to content

Commit 6ce5fea

Browse files
aalekhpatel07aalekhpatel07
andauthored
Add Polynomials (DS) + Unit tests, and Cycle Index Polynomial for Symmetry Groups (Algorithm) (keon#741)
* Put proper parenthesis for expected output. * Add the Monomial and Polynomial Data Structure for symbolic computation. * Add an algorithm to generate the cycle index polynomial for Symmetry Group on n symbols. * Add multiple Unit Tests for every Polynomial and Monomial operation. * Revert the parenthesis change because it didn't add much value. * Fix typo that introduced a Syntax Error. * Remove future annotations because of incompatibility of postponed evaluation of annotations in Python <= 3.6. * Add record for Polynomial and symmetry group index. Rearrange records to be alphabetical. Co-authored-by: aalekhpatel07 <aalekh.gwpeck.7998@gmail.com>
1 parent 8ebe8b5 commit 6ce5fea

File tree

6 files changed

+1088
-9
lines changed

6 files changed

+1088
-9
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,36 +198,38 @@ If you want to uninstall algorithms, it is as simple as:
198198
- [is_isomorphic](algorithms/map/is_isomorphic.py)
199199
- [is_anagram](algorithms/map/is_anagram.py)
200200
- [maths](algorithms/maths)
201-
- [power](algorithms/maths/power.py)
202201
- [base_conversion](algorithms/maths/base_conversion.py)
203202
- [combination](algorithms/maths/combination.py)
204203
- [cosine_similarity](algorithms/maths/cosine_similarity.py)
205204
- [decimal_to_binary_ip](algorithms/maths/decimal_to_binary_ip.py)
205+
- [diffie_hellman_key_exchange](algorithms/maths/diffie_hellman_key_exchange.py)
206206
- [euler_totient](algorithms/maths/euler_totient.py)
207207
- [extended_gcd](algorithms/maths/extended_gcd.py)
208208
- [factorial](algorithms/maths/factorial.py)
209+
- [find_order](algorithms/maths/find_order_simple.py)
210+
- [find_primitive_root](algorithms/maths/find_primitive_root_simple.py)
209211
- [gcd/lcm](algorithms/maths/gcd.py)
210212
- [generate_strobogrammtic](algorithms/maths/generate_strobogrammtic.py)
213+
- [hailstone](algorithms/maths/hailstone.py)
211214
- [is_strobogrammatic](algorithms/maths/is_strobogrammatic.py)
212-
- [magic_number](algorithms/maths/magic_number.py)
213215
- [krishnamurthy_number](algorithms/maths/krishnamurthy_number.py)
216+
- [magic_number](algorithms/maths/magic_number.py)
214217
- [modular_exponential](algorithms/maths/modular_exponential.py)
215218
- [modular_inverse](algorithms/maths/modular_inverse.py)
216219
- [next_bigger](algorithms/maths/next_bigger.py)
217220
- [next_perfect_square](algorithms/maths/next_perfect_square.py)
218221
- [nth_digit](algorithms/maths/nth_digit.py)
222+
- [polynomial](algorithms/maths/polynomial.py)
223+
- [power](algorithms/maths/power.py)
219224
- [prime_check](algorithms/maths/prime_check.py)
220225
- [primes_sieve_of_eratosthenes](algorithms/maths/primes_sieve_of_eratosthenes.py)
221226
- [pythagoras](algorithms/maths/pythagoras.py)
222227
- [rabin_miller](algorithms/maths/rabin_miller.py)
228+
- [recursive_binomial_coefficient](algorithms/maths/recursive_binomial_coefficient.py)
223229
- [rsa](algorithms/maths/rsa.py)
224230
- [sqrt_precision_factor](algorithms/maths/sqrt_precision_factor.py)
225231
- [summing_digits](algorithms/maths/summing_digits.py)
226-
- [hailstone](algorithms/maths/hailstone.py)
227-
- [recursive_binomial_coefficient](algorithms/maths/recursive_binomial_coefficient.py)
228-
- [find_order](algorithms/maths/find_order_simple.py)
229-
- [find_primitive_root](algorithms/maths/find_primitive_root_simple.py)
230-
- [diffie_hellman_key_exchange](algorithms/maths/diffie_hellman_key_exchange.py)
232+
- [symmetry_group_cycle_index](algorithms/maths/symmetry_group_cycle_index.py)
231233
- [matrix](algorithms/matrix)
232234
- [sudoku_validator](algorithms/matrix/sudoku_validator.py)
233235
- [bomb_enemy](algorithms/matrix/bomb_enemy.py)

algorithms/maths/gcd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def trailing_zero(x):
3232
return cnt
3333

3434
"""
35-
Given two non-negative integer a and b,
35+
Given two non-negative integer a and b,
3636
computes the greatest common divisor of a and b using bitwise operator.
3737
"""
3838

@@ -42,7 +42,7 @@ def gcd_bit(a, b):
4242
a >>= tza
4343
b >>= tzb
4444
while b:
45-
if a < b:
45+
if a < b:
4646
a, b = b, a
4747
a -= b
4848
a >>= trailing_zero(a)

0 commit comments

Comments
 (0)