Pythonic Data Structures and Algorithms
Minimal and clean example implementations of data structures and algorithms in Python 3.
Contributing
Thanks for your interest in contributing! There are many ways to contribute to this project. Get started here
Tests
Use unittest
For running all tests write down:
$ python3 -m unittest discover testsFor running some specific tests you can do this as following (Ex: sort):
$ python3 -m unittest tests.test_sortUse pytest
For running all tests write down:
$ python3 -m pytest testsInstall
If you want to use the API algorithms in your code, it is as simple as:
$ pip3 install algorithmsYou can test by creating a python file: (Ex: use merge_sort in sort)
from algorithms.sort import merge_sort
if __name__ == "__main__":
my_list = [1, 8, 3, 5, 6]
my_list = merge_sort(my_list)
print(my_list)Uninstall
If you want to uninstall algorithms, it is as simple as:
$ pip3 uninstall -y algorithmsList of Implementations
- arrays
- backtrack
- bfs
- bit
- calculator
- compression
- dfs
- distribution
- dp
- graph
- heap
- iterables
- linkedlist
- map
- maths
- base_conversion
- combination
- cosine_similarity
- decimal_to_binary_ip
- euler_totient
- extended_gcd
- factorial
- gcd/lcm
- generate_strobogrammtic
- is_strobogrammatic
- modular_exponential
- next_bigger
- next_perfect_square
- nth_digit
- prime_check
- primes_sieve_of_eratosthenes
- pythagoras
- rabin_miller
- rsa
- sqrt_precision_factor
- summing_digits
- hailstone
- matrix
- queues
- search
- set
- sort
- stack
- strings
- fizzbuzz
- delete_reoccurring
- strip_url_params
- validate_coordinates
- domain_extractor
- merge_string_checker
- add_binary
- breaking_bad
- decode_string
- encode_decode
- group_anagrams
- int_to_roman
- is_palindrome
- license_number
- make_sentence
- multiply_strings
- one_edit_distance
- rabin_karp
- reverse_string
- reverse_vowel
- reverse_words
- roman_to_int
- word_squares
- unique_morse
- judge_circle
- strong_password
- caesar_cipher
- contain_string
- count_binary_substring
- repeat_string
- min_distance
- longest_common_prefix
- rotate
- first_unique_char
- repeat_substring
- atbash_cipher
- tree
- unix
- union-find
Contributors
Thanks to all the contributors
who helped in building the repo.