Wavelet tree (#4267)

* Added the matrix_exponentiation.py file in maths directory

* Implemented the requested changes

* Update matrix_exponentiation.py

* resolve merge conflict with upstream branch

* add new line at end of file

* add wavelet_tree

* fix isort issue

* updating DIRECTORY.md

* fix variable names in wavelet_tree and correct typo

* Add type hints and variable renaming

* Update data_structures/binary_tree/wavelet_tree.py

Add doctests to placate the algorithm-bot, thanks to @cclauss.

Co-authored-by: Christian Clauss <cclauss@me.com>

* Move doctest to individual functions and reformat code

* Move common test array to the global scope and reuse in tests

* MMove test array to global scope and minor linting changes

* Correct the failing pytest tests

* MUse built-in list for type annotation

* Update wavelet_tree.py

* types-requests

* updating DIRECTORY.md

* Update wavelet_tree.py

* # type: ignore

* # type: ignore

* Update decrypt_caesar_with_chi_squared.py

* ,

* Update decrypt_caesar_with_chi_squared.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Aniruddha Bhattacharjee <aniruddha@Aniruddhas-MacBook-Air.local>
This commit is contained in:
Aniruddha Bhattacharjee
2021-06-09 02:19:33 +05:30
committed by GitHub
parent f37d415227
commit b743e44259
5 changed files with 214 additions and 4 deletions

View File

@ -222,9 +222,10 @@ def decrypt_caesar_with_chi_squared(
# Get the most likely cipher by finding the cipher with the smallest chi squared
# statistic
most_likely_cipher: int = min(
chi_squared_statistic_values, key=chi_squared_statistic_values.get
) # type: ignore # First argument to `min` is not optional
most_likely_cipher: int = min( # type: ignore
chi_squared_statistic_values, # type: ignore
key=chi_squared_statistic_values.get, # type: ignore
) # type: ignore
# Get all the data from the most likely cipher (key, decoded message)
(