{"id":15718456,"url":"https://github.com/justintime50/algorithms","last_synced_at":"2025-05-05T21:46:52.008Z","repository":{"id":37625132,"uuid":"308559064","full_name":"Justintime50/algorithms","owner":"Justintime50","description":"Classic algorithms including Fizz Buzz, Bubble Sort, the Fibonacci Sequence, a Sudoku solver, and more.","archived":false,"fork":false,"pushed_at":"2024-10-10T22:05:25.000Z","size":127,"stargazers_count":17,"open_issues_count":0,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T00:04:53.711Z","etag":null,"topics":["algorithm","algorithm-complexity","algorithms","big-o","big-o-notation","bubble-sort","fibonacci-sequence","fizz-buzz","fizzbuzz","sudoku","sudoku-solver"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Justintime50.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2020-10-30T07:43:58.000Z","updated_at":"2024-12-04T03:04:09.000Z","dependencies_parsed_at":"2023-01-21T13:17:46.092Z","dependency_job_id":"66b8fd74-0024-4021-bd13-df13ebcdfab5","html_url":"https://github.com/Justintime50/algorithms","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Justintime50%2Falgorithms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Justintime50%2Falgorithms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Justintime50%2Falgorithms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Justintime50%2Falgorithms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Justintime50","download_url":"https://codeload.github.com/Justintime50/algorithms/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252582505,"owners_count":21771671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["algorithm","algorithm-complexity","algorithms","big-o","big-o-notation","bubble-sort","fibonacci-sequence","fizz-buzz","fizzbuzz","sudoku","sudoku-solver"],"created_at":"2024-10-03T21:53:06.260Z","updated_at":"2025-05-05T21:46:51.968Z","avatar_url":"https://github.com/Justintime50.png","language":"Python","readme":"\u003cdiv align=\"center\"\u003e\n\n# Algorithms\n\nClassic algorithms including Fizz Buzz, Bubble Sort, the Fibonacci Sequence, a Sudoku solver, and more.\n\n[![Build](https://github.com/Justintime50/algorithms/workflows/build/badge.svg)](https://github.com/Justintime50/algorithms/actions)\n[![Coverage Status](https://coveralls.io/repos/github/Justintime50/algorithms/badge.svg?branch=main)](https://coveralls.io/github/Justintime50/algorithms?branch=main)\n[![Licence](https://img.shields.io/github/license/justintime50/algorithms)](LICENSE)\n\n\u003cimg src=\"https://raw.githubusercontent.com/justintime50/assets/main/src/algorithms/showcase.png\" alt=\"Showcase\"\u003e\n\n\u003c/div\u003e\n\n## Algorithm Complexity\n\n\u003e Time and Space Complexity (Big O Notation)\n\nAll algorithms have a complexity known as `Big O Notation`, the more complex an algorithm, the less efficient it gets as more data is introduced. Listed below are the `Big-O` complexities listed from best to worst:\n\n* O(1)\n* O(log n)\n* O(n)\n* O(n * log n)\n* O(n^2)\n* O(2^n)\n* O(n!)\n\n\u003cimg src=\"https://raw.githubusercontent.com/justintime50/assets/main/src/algorithms/big_o_notation.png\" alt=\"Showcase\"\u003e\n\n## Available Algorithms\n\n### Recursion\n\n[**Invert Binary Tree - O(n)**](algorithms/recursion/invert_binary_tree.py)\n\n\u003cimg src=\"https://raw.githubusercontent.com/justintime50/assets/main/src/algorithms/invert_binary_tree.png\" alt=\"Showcase\"\u003e\n\n[**Sudoku Solver - O(n)**](algorithms/recursion/sudoku.py)\n\n```text\nOriginal:\n[3, 0, 6, 5, 0, 8, 4, 0, 0]\n[5, 2, 0, 0, 0, 0, 0, 0, 0]\n[0, 8, 7, 0, 0, 0, 0, 3, 1]\n[0, 0, 3, 0, 1, 0, 0, 8, 0]\n[9, 0, 0, 8, 6, 3, 0, 0, 5]\n[0, 5, 0, 0, 9, 0, 6, 0, 0]\n[1, 3, 0, 0, 0, 0, 2, 5, 0]\n[0, 0, 0, 0, 0, 0, 0, 7, 4]\n[0, 0, 5, 2, 0, 6, 3, 0, 0]\n\n\nSolved:\n[3, 1, 6, 5, 7, 8, 4, 9, 2]\n[5, 2, 9, 1, 3, 4, 7, 6, 8]\n[4, 8, 7, 6, 2, 9, 5, 3, 1]\n[2, 6, 3, 4, 1, 5, 9, 8, 7]\n[9, 7, 4, 8, 6, 3, 1, 2, 5]\n[8, 5, 1, 7, 9, 2, 6, 4, 3]\n[1, 3, 8, 9, 4, 7, 2, 5, 6]\n[6, 9, 2, 3, 5, 1, 8, 7, 4]\n[7, 4, 5, 2, 8, 6, 3, 1, 9]\nNumbers put into the Sudoku puzzle: 769\nNumbers that had to be backtracked due to a dead-end: 720\n```\n\n### Search\n\n\u003cimg src=\"algorithms/assets/breadth_first_graph.jpg\" alt=\"Breadth First Search Graph\"\u003e\n\nThis graph is for both Breadth and Depth First Search ^\n\n[**Breadth First Search - O(V + E)**](algorithms/search/breadth_first_search.py)\n\nThe purpose of this algorithm is to search all neighbors before traversing further down the graph. A real world use-case of this is GPS navigation to find the shortest route to your destination.\n\n```text\n[5, 3, 7, 2, 4, 8]\n```\n\n[**Depth First Search - O(V + E)**](algorithms/search/depth_first_search.py)\n\nThe purpose of this algorithm is to traverse an entire branch before backtracking to traverse a neighbor higher up the graph. A real world use-case of this is solving a puzzle with only one solution (eg: Sudoku solver)\n\n```text\n[5, 3, 2, 4, 8, 7]\n```\n\n### Sequences\n\n[**Fibonnaci Sequence - O(2^n)**](algorithms/sequences/fibonnaci_sequence.py)\n\n```text\nThe Fibonacci Sequence to 20 iterations:\n0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181\n```\n\n[**Fizz Buzz - O(n)**](algorithms/sequences/fizzbuzz.py)\n\n```text\nFizz Buzz to 15 iterations:\n1\n2\nFizz\n4\nBuzz\nFizz\n7\n8\nFizz\nBuzz\n11\nFizz\n13\n14\nFizzBuzz\n```\n\n### Sorting\n\n[**Bubble Sort - O(1)**](algorithms/sorting/bubble_sort.py)\n\n```text\nOriginal: [3, 1, 5, 9, 7, 6, 2, 8, 4]\n[1, 3, 5, 9, 7, 6, 2, 8, 4] =\u003e Swapped 3 and 1\n[1, 3, 5, 7, 9, 6, 2, 8, 4] =\u003e Swapped 9 and 7\n[1, 3, 5, 7, 6, 9, 2, 8, 4] =\u003e Swapped 9 and 6\n[1, 3, 5, 7, 6, 2, 9, 8, 4] =\u003e Swapped 9 and 2\n[1, 3, 5, 7, 6, 2, 8, 9, 4] =\u003e Swapped 9 and 8\n[1, 3, 5, 7, 6, 2, 8, 4, 9] =\u003e Swapped 9 and 4\n[1, 3, 5, 6, 7, 2, 8, 4, 9] =\u003e Swapped 7 and 6\n[1, 3, 5, 6, 2, 7, 8, 4, 9] =\u003e Swapped 7 and 2\n[1, 3, 5, 6, 2, 7, 4, 8, 9] =\u003e Swapped 8 and 4\n[1, 3, 5, 2, 6, 7, 4, 8, 9] =\u003e Swapped 6 and 2\n[1, 3, 5, 2, 6, 4, 7, 8, 9] =\u003e Swapped 7 and 4\n[1, 3, 2, 5, 6, 4, 7, 8, 9] =\u003e Swapped 5 and 2\n[1, 3, 2, 5, 4, 6, 7, 8, 9] =\u003e Swapped 6 and 4\n[1, 2, 3, 5, 4, 6, 7, 8, 9] =\u003e Swapped 3 and 2\n[1, 2, 3, 4, 5, 6, 7, 8, 9] =\u003e Swapped 5 and 4\nList sorted successfully in 0:00:00.000080 with Bubble Sort Algorithm!\n```\n\n[**Wordle Solver - O(n^2)**](algorithms/sorting/wordle_solver.py)\n\n```text\nTotal number of Wordles: 12947\nMost common starting letter: [('s', 365), ('c', 198), ('b', 173), ('t', 149), ('p', 141), ('a', 140), ('f', 135), ('g', 115), ('d', 111), ('m', 107), ('r', 105), ('l', 87), ('w', 82), ('e', 72), ('h', 69), ('v', 43), ('o', 41), ('n', 37), ('i', 34), ('u', 33), ('q', 23), ('k', 20), ('j', 20), ('y', 6), ('z', 3)]\nMost common letters: [('e', 31980), ('a', 25350), ('r', 23322), ('o', 19578), ('t', 18954), ('l', 18616), ('i', 17420), ('s', 17368), ('n', 14898), ('c', 12350), ('u', 12116), ('y', 11024), ('d', 10218), ('h', 10062), ('p', 9490), ('m', 8216), ('g', 8060), ('b', 7280), ('f', 5954), ('k', 5460), ('w', 5044), ('v', 3952), ('z', 1040), ('x', 962), ('q', 754), ('j', 702)]\nPossible words: 2251\nTop 5 Best Guesses:\n('steer', 117)\n('stare', 116)\n('store', 114)\n('sleet', 114)\n('steel', 114)\n```\n\nWatch a video about the creation of this solver: \u003chttps://www.youtube.com/watch?v=KiOiV8rpC7c\u003e\n\n## Install\n\n```bash\njust install\n```\n\n## Usage\n\nSee each script for additional descriptions, usage, features, and lessons learned.\n\n```bash\nvenv/bin/python algorithms/category/script.py\n```\n\n## Development\n\n```bash\n# Get a comprehensive list of development tools\njust --list\n```\n\n## Contributing\n\nI will not be accepting pull requests to this repo for new algorithms as this project is more of a playground for my own learning and exploration of algorithms and not an exhaustive collection for reference. I will consider improvement PRs for existing algorithms however.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustintime50%2Falgorithms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustintime50%2Falgorithms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustintime50%2Falgorithms/lists"}