⭐️ ALGOHUB - HUB OF ALGORITHMS ⭐️
All algorithms implemented in PYTHON
Table of Contents
About
This repository contains a collection of algorithms written in Python. You can find algorithms for handling numbers, including ciphers, strings and for sorting data. It is wise to learn and implement them in your projects 💯Documenation
Comprehensive documentation available at this link:SPHINX DOCUMENTATION
‼️ 📄 Feel free to explore detailed README documentation for each package below 📃 ‼️
Code Quality Checks
Pylint Rating
Measures quality of code and its adherence to coding standards and best practices.
My score:
Your code has been rated at 9.81/10 (previous run: 9.81/10, +0.00)
Mypy
Analyzes code to verify that the actual usage of variables, function arguments and return values matches the type specified in the annotations (type hints). Overall the code demonstrates high compatibility with type annotations.
Data
Except for algorithms in package there is also a data package. It consists of many useful functions for retrieving the data from user, random number generation and data validation. Feel free to explore it!Example usage
from algohub.algorithms.data.validation import does_string_match_regex
pattern = r'^[A-Z]{3};[a-z]+;\d$'
text = "ULA;developer;2"
text_2 = "KLAUDIA;developer;3"
result = does_string_match_regex(text, pattern)
result_2 = does_string_match_regex(text_2, pattern)
print(f'Text {text} matches regex: {result}') # True
print(f'Text {text_2} matches regex: {result_2}') # False
Example usage of algorithms
Ciphers
from algohub.algorithms.ciphers import vigenere
# Creating an instance of Vigenère square
key = "CAT"
vigenere_square = VigenereCipher("CAT")
# Encrypting a text
plaintext = "HOME"
encrypted_text = vigenere_square.encrypt(plaintext)
print(f'Encrypted: {encrypted_text}') # JOFG
# Decrypting a text
decrypted_text = vigenere_square.decrypt(encrypted_text)
print(f'Decrypted: {decrypted_text}') # HOME
Strings
from algohub.algorithms.strings import string_manipulation
compressed_string = string_manipulation.compress("ABCABa")
print(f'Compression: {compressed_string}') # A2B2C1a1
Numbers
from algohub.algorithms.numbers.num_base_conversion import any_to_decimal, decimal_to_any
Decimal to binary conversion
decimal_number = 10
binary_number = decimal_to_any(decimal_number, 2)
print(f'Binary representation of {decimal_number}: {binary_number}') # "1010"
Octal to decimal conversion
octal_number = '144'
decimal_number = any_to_decimal(octal_number, 8)
print(f'Decimal representation of {octal_number}: {decimal_number}') # 100
OVERVIEW OF ALGORITHMS
Numbers
Digits
-
get_digits
- sum_digits
- move_zeroes
Divisors
- count_divisors
- count_common_divisors
- sum_divisors
Primes
- Eratosthenes Sieve
- is_prime_basic
- get_prime_factors
- is_perfect_number
Number base conversion
- decimal_to_any & any_to_decimal
- decimal_to_hexadecimal & hexadecimal_to_decimal
- binary_to_hexadecimal & hexadecimal_to_binary
- binary_to_octal & octal_to_binary
- octal_to_hexadecimal & hexadecimal_to_octal
Math
Arithmetic algorithms
- binary_search
- babylonian_sqrt
- binary_exponentiation
- iterative_factorial
- recursive_factorial
Function algorithms
- bisection_root
- quadratic_roots
- horner_evaluation
- trapezoidal_integration
- rectangular_integration
Geometric algorithms
- distane_between_points
- are_points_collinear
- is_triangle_valid
- is_triangle_rectangular
Strings
String analysis
- is_anagram
- is_pangram
- is_palindrome
- is_subsequence
- count_substring_occurences
- contains_duplicates
String manipulation
- reverse
- compress
- custom_join
- lower
- upper
Custom string sorting
- sort_items
- compare_vowels_count
- compare_chars_sum
Ciphers
- caesar_cipher
- vigenere_cipher
- morse_code
Sorting
- quick_sort
- bubble_sort
- merge_sort
- selection_sort
Metadata
Release files for algohub 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| algohub-0.1.0.tar.gz | 50.8 kB | Without provenance | Details for algohub-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| algohub-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for algohub-0.1.0-py3-none-any.whl |
Total release size: 84.7 kB
Release files / algohub-0.1.0.tar.gz
| Download URL | algohub-0.1.0.tar.gz |
|---|---|
| Size | 50.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d93e3e0cd725c3f495f36640d45a180989bc91af24852652452a231c23e568c
|
|
BLAKE2b-256 checksum How to use checksums |
14156d260fff2c2f732e9bc96277dcc19f14b13ddce1b6587bf1a5c3cf067328
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.12.1 Darwin/22.6.0
|
Release files / algohub-0.1.0-py3-none-any.whl
| Download URL | algohub-0.1.0-py3-none-any.whl |
|---|---|
| Size | 34.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
abbf58c42e243032af75d0d20f0bd3813f57274688fc8ec94092879e2a2d2586
|
|
BLAKE2b-256 checksum How to use checksums |
0b11f945bdb653b539c7ac8891001a523504f5ded9a96ca836732b367aa21e81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.12.1 Darwin/22.6.0
|
Security for algohub 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.