Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/soroush-04/algorithms-data-structures
https://github.com/soroush-04/algorithms-data-structures
algorithms data-structures python
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/soroush-04/algorithms-data-structures
- Owner: soroush-04
- Created: 2024-09-19T15:03:30.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-10-24T00:39:35.000Z (3 months ago)
- Last Synced: 2024-10-26T22:15:50.737Z (2 months ago)
- Topics: algorithms, data-structures, python
- Language: Python
- Homepage:
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Algorithms and Data Structures Practice in Python
## Favorite Problems
- **Mushroom Picker**
- Technique: Prefix Sums, Two Pointers | [Code Link](https://github.com/soroush-04/Algorithms-DS/commit/30a49e17b09a87c77d69216f6834c818f520a6ca)
- **Genomic Range Query**
- Technique: Prefix Sums, Two Pointers, Sliding Window | [Code Link](https://github.com/soroush-04/Algorithms-DS/commit/a0d98aaf3dd05eae152d93a32d31836036871d7c)
- **Graph Valid Tree**
- Technique: DFS, Cycle Checking, Connectivity Check | [Code Link](https://github.com/soroush-04/Algorithms-DS/commit/ea384f78d6560cc8b4b2e4e3a89144e57ce9c166)## Common mistakes
### Slicing
- A[-K:]: This slice retrieves the last K elements from the list, starting from the K-th element from the end.
- A[:-K]: This slice retrieves all elements from the beginning of the list up to (but not including) the last K elements.
- Sample problem: cyclic rotation### Set()
- Whenever we only care about uniqueness and a single occurence, consider using sets.
- Converting the list to a set allows O(1) average time complexity for membership checks.### Sliding Window
- Consider using this technique when searching for specific subarrays or contiguous sequences.### BFS
- Consider using it for shortest path in unweighted graphs.### DFS
- Consider using it for backtracking scenarios.### Nested Data
- **Hashmaps**: Use `.items()` to iterate through key-value pairs and use the value to move one layer inward.
- **Lists**: Use `item in items` to move one layer inward.