|
36 | 36 |
|
37 | 37 | Implementations are for learning purposes only. They may be less efficient than the implementations in the Python standard library. Use them at your discretion. |
38 | 38 |
|
39 | | -## � Table of Contents |
40 | | - |
41 | | -- [About](#-about) |
42 | | -- [Features](#-features) |
43 | | -- [Getting Started](#-getting-started) |
44 | | - - [Installation](#installation) |
45 | | - - [Usage](#usage) |
46 | | -- [Algorithm Categories](#-algorithm-categories) |
47 | | -- [Community Channels](#-community-channels) |
48 | | -- [Contributing](#-contributing) |
49 | | -- [License](#-license) |
50 | | -- [List of Algorithms](#-list-of-algorithms) |
51 | | - |
52 | | -## � About |
53 | | - |
54 | | -This repository contains Python implementations of various algorithms and data structures for educational purposes. Whether you're a student learning algorithms, a developer preparing for technical interviews, or someone interested in computer science fundamentals, this collection provides clear and well-documented examples. |
55 | | - |
56 | | -## ✨ Features |
57 | | - |
58 | | -This repository includes implementations of algorithms across multiple categories: |
59 | | - |
60 | | -- **Sorting Algorithms**: Bubble sort, Quick sort, Merge sort, Heap sort, and more |
61 | | -- **Searching Algorithms**: Binary search, Linear search, Jump search, Interpolation search |
62 | | -- **Data Structures**: Linked lists, Stacks, Queues, Trees, Graphs, Hash tables |
63 | | -- **Graph Algorithms**: BFS, DFS, Dijkstra's algorithm, Floyd-Warshall, Bellman-Ford |
64 | | -- **Dynamic Programming**: Knapsack, Longest Common Subsequence, Edit Distance |
65 | | -- **Machine Learning**: Neural networks, Linear regression, K-means clustering |
66 | | -- **Mathematical Algorithms**: Prime number algorithms, GCD, LCM, Number theory |
67 | | -- **String Algorithms**: Pattern matching, String manipulation, Parsing |
68 | | -- **Cryptography**: Various cipher implementations |
69 | | -- **Computer Vision**: Image processing algorithms |
70 | | -- **And many more!** |
71 | | - |
72 | | -All implementations include: |
73 | | - |
74 | | -- Clear documentation and explanations |
75 | | -- Type hints for better code readability |
76 | | -- Doctests for validation |
77 | | -- Educational comments |
78 | | - |
79 | 39 | ## 🚀 Getting Started |
80 | 40 |
|
81 | | -### Installation |
82 | | - |
83 | | -1. **Clone the repository** |
84 | | - |
85 | | - ```bash |
86 | | - git clone https://github.com/TheAlgorithms/Python.git |
87 | | - cd Python |
88 | | - ``` |
89 | | - |
90 | | -2. **Set up a virtual environment (recommended)** |
91 | | - |
92 | | - ```bash |
93 | | - python -m venv venv |
94 | | - |
95 | | - # On Windows |
96 | | - venv\Scripts\activate |
97 | | - |
98 | | - # On macOS/Linux |
99 | | - source venv/bin/activate |
100 | | - ``` |
101 | | - |
102 | | -3. **Install dependencies** |
103 | | - |
104 | | - ```bash |
105 | | - pip install -r requirements.txt |
106 | | - ``` |
107 | | - |
108 | | -### Usage |
109 | | - |
110 | | -Each algorithm is self-contained in its own file. You can run any algorithm directly or import it into your own projects. |
111 | | - |
112 | | -**Example 1: Running an algorithm directly** |
113 | | - |
114 | | -```bash |
115 | | -python sorts/quick_sort.py |
116 | | -``` |
117 | | - |
118 | | -**Example 2: Importing and using an algorithm** |
119 | | - |
120 | | -```python |
121 | | -from sorts.quick_sort import quick_sort |
122 | | - |
123 | | -# Sort a list |
124 | | -numbers = [64, 34, 25, 12, 22, 11, 90] |
125 | | -sorted_numbers = quick_sort(numbers) |
126 | | -print(sorted_numbers) # Output: [11, 12, 22, 25, 34, 64, 90] |
127 | | -``` |
128 | | - |
129 | | -**Example 3: Running doctests** |
130 | | - |
131 | | -```bash |
132 | | -python -m doctest -v sorts/bubble_sort.py |
133 | | -``` |
134 | | - |
135 | | -## 📂 Algorithm Categories |
136 | | - |
137 | | -For a complete list of all implemented algorithms organized by category, see our [DIRECTORY.md](DIRECTORY.md) file. |
| 41 | +📋 Read through our [Contribution Guidelines](CONTRIBUTING.md) before you contribute. |
138 | 42 |
|
139 | 43 | ## 🌐 Community Channels |
140 | 44 |
|
141 | 45 | We are on [Discord](https://the-algorithms.com/discord)! Community channels are a great way for you to ask questions and get help. Please join us! |
142 | 46 |
|
143 | | -## 🤝 Contributing |
144 | | - |
145 | | -We welcome contributions from the community! Before contributing: |
146 | | - |
147 | | -1. 📋 Read through our [Contribution Guidelines](CONTRIBUTING.md) |
148 | | -2. 🔍 Check existing implementations to avoid duplicates |
149 | | -3. ✅ Ensure your code follows our coding standards |
150 | | -4. 🧪 Include doctests and proper documentation |
151 | | -5. 🎯 Make sure all tests pass before submitting |
152 | | - |
153 | | -**Quick Start for Contributors:** |
154 | | - |
155 | | -```bash |
156 | | -# Install pre-commit hooks |
157 | | -pip install pre-commit |
158 | | -pre-commit install |
159 | | - |
160 | | -# Run tests |
161 | | -python -m pytest |
162 | | - |
163 | | -# Format code |
164 | | -pip install ruff |
165 | | -ruff check |
166 | | -``` |
167 | | - |
168 | | -Contributions that are most welcome: |
169 | | - |
170 | | -- New algorithm implementations |
171 | | -- Improvements to existing algorithms |
172 | | -- Better documentation and explanations |
173 | | -- Bug fixes |
174 | | -- Test coverage improvements |
175 | | - |
176 | | -## 📄 License |
177 | | - |
178 | | -This project is licensed under the [MIT License](LICENSE.md) - see the [LICENSE.md](LICENSE.md) file for details. |
179 | | - |
180 | | -This means you are free to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software. |
181 | | - |
182 | 47 | ## 📜 List of Algorithms |
183 | 48 |
|
184 | 49 | See our [directory](DIRECTORY.md) for easier navigation and a better overview of the project. |
0 commit comments