{"id":20020552,"url":"https://github.com/soroush-04/algorithms-data-structures","last_synced_at":"2026-04-20T14:31:18.804Z","repository":{"id":259610913,"uuid":"859954599","full_name":"soroush-04/Algorithms-Data-Structures","owner":"soroush-04","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-18T02:31:20.000Z","size":80,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-18T02:47:35.114Z","etag":null,"topics":["algorithms","data-structures","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soroush-04.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-19T15:03:30.000Z","updated_at":"2025-05-18T02:31:23.000Z","dependencies_parsed_at":"2024-10-26T22:15:52.706Z","dependency_job_id":"2217f85d-5742-4526-9f87-c95e161a5d55","html_url":"https://github.com/soroush-04/Algorithms-Data-Structures","commit_stats":null,"previous_names":["soroush-04/algorithms-data-structures"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/soroush-04/Algorithms-Data-Structures","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroush-04%2FAlgorithms-Data-Structures","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroush-04%2FAlgorithms-Data-Structures/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroush-04%2FAlgorithms-Data-Structures/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroush-04%2FAlgorithms-Data-Structures/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soroush-04","download_url":"https://codeload.github.com/soroush-04/Algorithms-Data-Structures/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroush-04%2FAlgorithms-Data-Structures/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32050875,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","data-structures","python"],"created_at":"2024-11-13T08:32:54.408Z","updated_at":"2026-04-20T14:31:18.793Z","avatar_url":"https://github.com/soroush-04.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Algorithms and Data Structures Practice in Python\n\n## Favorite Problems\n- **Mushroom Picker**\n  - Technique: Prefix Sums, Two Pointers | [Code Link](https://github.com/soroush-04/Algorithms-DS/commit/30a49e17b09a87c77d69216f6834c818f520a6ca)\n- **Genomic Range Query**\n  - Technique: Prefix Sums, Two Pointers, Sliding Window | [Code Link](https://github.com/soroush-04/Algorithms-DS/commit/a0d98aaf3dd05eae152d93a32d31836036871d7c)\n- **Graph Valid Tree**\n  - Technique: DFS, Cycle Checking, Connectivity Check | [Code Link](https://github.com/soroush-04/Algorithms-DS/commit/ea384f78d6560cc8b4b2e4e3a89144e57ce9c166)\n- **N-Queens**\n  - Technique: Backtracking | [Code Link](https://github.com/soroush-04/Algorithms-DS/blob/main/favorites/n_queens.py)\n- **Top K Frequent Elements**\n  - Technique: Bucket Sort | [Code Link](https://github.com/soroush-04/Algorithms-DS/blob/main/favorites/top_k_frequency.py)\n- **Counting Bits**\n  - Technique: Bit Manipulation, Dynamic Programming | [Code Link](https://github.com/soroush-04/Algorithms-DS/blob/main/favorites/counting_bits.py)\n- **Subtree of Another Tree**\n  - Technique: Tree Traversal, Recursion | [Code Link](https://github.com/soroush-04/Algorithms-DS/blob/main/favorites/subtree.py)\n- **Balanced Binary Tree**\n  - Technique: DFS, Height Calculation | [Code Link](https://github.com/soroush-04/Algorithms-DS/blob/main/favorites/balanced_binary_tree.py)\n- **Letter Combinations of a Phone Number**\n  - Technique: backtracking, string join | [Code Link](https://github.com/soroush-04/Algorithms-DS/blob/main/favorites/letters_phone_numer.py)\n- **Permutations**\n  - Technique: backtracking | [Code Link](https://github.com/soroush-04/Algorithms-DS/blob/main/favorites/permutations.py)\n- **Equal Row and Column Pairs**\n  - Technique: Hashmaps, Tuples, Matrix | [Code Link](https://github.com/soroush-04/Algorithms-DS/blob/main/favorites/equal_pairs.py)\n\n\n\n\n## Common mistakes\n### Slicing \n- A[-K:]: This slice retrieves the last K elements from the list, starting from the K-th element from the end.\n- A[:-K]: This slice retrieves all elements from the beginning of the list up to (but not including) the last K elements.\n  - Sample problem: cyclic rotation\n\n### Set()\n- Whenever we only care about uniqueness and a single occurence, consider using sets.\n- Converting the list to a set allows O(1) average time complexity for membership checks.\n\n### Sliding Window\n- Consider using this technique when searching for specific subarrays or contiguous sequences.\n\n### Hashmaps\n- Use tuples as keys if needed not the list.\n\n### Stack\n- You need to perform on current and previous index? Consider using stack for optimized performance. \n\n### Sorting\n- Merge Sort has guaranteed O(n log n) time complexity, which can be preferable when the worst case is a concern.\n\n### Bucket Sort\n- Optimize the time complexity to O(N).\n- It is a 2D array,\n- We kinda try to swap and redesign the key-values of frequency hashmap.\n\n### Trees\n- In BST do not traverse the wrong subtree!\n- Don't forget to propagate the state of unbalanced subtrees up the tree.\n\n### BFS\n- Consider using it for shortest path in unweighted graphs.\n\n### DFS\n- Consider using it for backtracking scenarios.\n\n### Nested Data\n- **Hashmaps**: Use `.items()` to iterate through key-value pairs and use the value to move one layer inward. \n- **Lists**: Use `item in items` to move one layer inward.\n\n### Backtracking\n- Don’t forget to undo (backtrack) changes after recursive calls.\n- Recursion base case must be created accuractely.\n- Don't forget to call the backtracking function at the end!\n- Each for loop in a recursive callback function has its separate own state.\n\n### Dynamic Programming\n- Check for fibonnaci patterns\n\n### Bit Manipulation\n- Logical and returns the first falsy value or the last value if all are truthy.\n- Logical or returns the first truthy value.\n- XOR: like a toggle switch to add/remove features. Also keep in mind XOR of two same numbers is zero.\n- Check LSB (least significant bit) with 'i \u0026 1'  or 'i % 2'","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoroush-04%2Falgorithms-data-structures","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoroush-04%2Falgorithms-data-structures","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoroush-04%2Falgorithms-data-structures/lists"}