├── .isort.cfg ├── .pre-commit-config.yaml ├── LICENSE ├── .gitignore └── README.md /.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | known_third_party = 3 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v2.5.0 4 | hooks: 5 | - id: trailing-whitespace 6 | - id: end-of-file-fixer 7 | - id: check-docstring-first 8 | - id: check-json 9 | - id: check-yaml 10 | - id: double-quote-string-fixer 11 | 12 | - repo: https://github.com/ambv/black 13 | rev: 19.10b0 14 | hooks: 15 | - id: black 16 | args: ["--line-length", "100", "--skip-string-normalization"] 17 | 18 | - repo: https://github.com/pre-commit/pre-commit-hooks 19 | rev: v2.5.0 20 | hooks: 21 | - id: flake8 22 | - repo: https://github.com/asottile/seed-isort-config 23 | rev: v2.1.0 24 | hooks: 25 | - id: seed-isort-config 26 | - repo: https://github.com/pre-commit/mirrors-isort 27 | rev: v4.3.21 28 | hooks: 29 | - id: isort 30 | 31 | - repo: https://github.com/prettier/prettier 32 | rev: 1.19.1 33 | hooks: 34 | - id: prettier 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-Onwards Anderson Banihirwe 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | 35 | # Python 36 | 37 | # Byte-compiled / optimized / DLL files 38 | __pycache__/ 39 | *.py[cod] 40 | *$py.class 41 | 42 | # C extensions 43 | *.so 44 | 45 | # Distribution / packaging 46 | .Python 47 | env/ 48 | build/ 49 | develop-eggs/ 50 | dist/ 51 | downloads/ 52 | eggs/ 53 | .eggs/ 54 | lib/ 55 | lib64/ 56 | parts/ 57 | sdist/ 58 | var/ 59 | wheels/ 60 | *.egg-info/ 61 | .installed.cfg 62 | *.egg 63 | 64 | # PyInstaller 65 | # Usually these files are written by a python script from a template 66 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 67 | *.manifest 68 | *.spec 69 | 70 | # Installer logs 71 | pip-log.txt 72 | pip-delete-this-directory.txt 73 | 74 | # Unit test / coverage reports 75 | htmlcov/ 76 | .tox/ 77 | .coverage 78 | .coverage.* 79 | .cache 80 | nosetests.xml 81 | coverage.xml 82 | *.cover 83 | .hypothesis/ 84 | 85 | # Translations 86 | *.mo 87 | *.pot 88 | 89 | # Django stuff: 90 | *.log 91 | local_settings.py 92 | 93 | # Flask stuff: 94 | instance/ 95 | .webassets-cache 96 | 97 | # Scrapy stuff: 98 | .scrapy 99 | 100 | # Sphinx documentation 101 | docs/_build/ 102 | 103 | # PyBuilder 104 | target/ 105 | 106 | # Jupyter Notebook 107 | .ipynb_checkpoints 108 | 109 | # pyenv 110 | .python-version 111 | 112 | # celery beat schedule file 113 | celerybeat-schedule 114 | 115 | # SageMath parsed files 116 | *.sage.py 117 | 118 | # dotenv 119 | .env 120 | 121 | # virtualenv 122 | .venv 123 | venv/ 124 | ENV/ 125 | 126 | # Spyder project settings 127 | .spyderproject 128 | .spyproject 129 | 130 | # Rope project settings 131 | .ropeproject 132 | 133 | # mkdocs documentation 134 | /site 135 | 136 | # mypy 137 | .mypy_cache/ 138 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Algorithms 2 | 3 | Data Structure and Algorithms implementations in Python 4 | 5 | **Note** 6 | This repository is meant to be used as a reference to learn data structures and algorithms in Python programming language. 7 | 8 | **Documentation** 9 | TODO 10 | 11 | ## Data structure 12 | 13 | ## TO DO 14 | 15 | - Sorting Algorithms 16 | _ [Bubble Sort](https://en.wikipedia.org/wiki/Bubble_sort) 17 | _ [Selection Sort](https://en.wikipedia.org/wiki/Selection_sort) 18 | _ [Insertion Sort](https://en.wikipedia.org/wiki/Insertion_sort) 19 | _ [Merge Sort](https://en.wikipedia.org/wiki/Merge_sort) 20 | _ [Quick Sort](https://en.wikipedia.org/wiki/Quicksort) 21 | _ [Quick Select](https://en.wikipedia.org/wiki/Quickselect) 22 | _ [Shell Sort](https://en.wikipedia.org/wiki/Shellsort) 23 | _ [Heap Sort](https://en.wikipedia.org/wiki/Heapsort) 24 | - [Stack (Array Implementation)]() 25 | _ Infix to Postfix 26 | _ Infix to Prefix \* Infix Evaluation 27 | - [Queue (Array Implementation)]() 28 | - LinkedList 29 | _ [Singly Linked List](https://en.wikipedia.org/wiki/Linked_list) 30 | _ [Doubly Linked List](https://en.wikipedia.org/wiki/Doubly_linked_list) 31 | - [Shuffle (Using Fisher-Yates (Knuth) shuffling algorithm)](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle) 32 | - [Binary Search Tree](https://en.wikipedia.org/wiki/Binary_search_tree) 33 | - [Binary Heap](https://en.wikipedia.org/wiki/Binary_heap) 34 | - Min Heap 35 | - Max Heap 36 | - [Red Black Tree](https://en.wikipedia.org/wiki/Red%E2%80%93black_tree) 37 | - Search 38 | 39 | - [Binary Search](https://en.wikipedia.org/wiki/Binary_search_algorithm) 40 | 41 | - Vertical Order Traversal of Tree 42 | - Order Statistics of Tree 43 | - Red Black Tree Deletion 44 | - B-Tree 45 | - Deque using circular array 46 | - Tree Varient 47 | - Graph Varient 48 | - [cocktail sort](https://en.wikipedia.org/wiki/Cocktail_shaker_sort) 49 | - [gnome sort](https://en.wikipedia.org/wiki/Gnome_sort) 50 | - [comb sort](https://en.wikipedia.org/wiki/Comb_sort) 51 | - [odd-even sort](https://en.wikipedia.org/wiki/Odd%E2%80%93even_sort) 52 | - [counting sort](https://en.wikipedia.org/wiki/Counting_sort) 53 | 54 | ## Contribution 55 | 56 | Feel Free to contribute! 57 | --------------------------------------------------------------------------------