{"id":19241750,"url":"https://github.com/zaahidali/algorithms-python","last_synced_at":"2025-02-23T14:29:47.835Z","repository":{"id":162542251,"uuid":"256778934","full_name":"zaahidali/algorithms-python","owner":"zaahidali","description":"This repository contains Python implementations of various sorting and searching algorithms. Explore the code examples and learn how these algorithms work.","archived":false,"fork":false,"pushed_at":"2023-06-04T14:43:06.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-05T03:12:09.226Z","etag":null,"topics":["binary-search","binarysearch","bubble-sort","bubblesort","linear-search","linearsearch","python-programming","python3","searching-algorithms","sorting-algorithms"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/zaahidali.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}},"created_at":"2020-04-18T14:51:03.000Z","updated_at":"2023-06-04T14:44:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"798f30fa-5446-492e-94a3-4ff2f9f03e6a","html_url":"https://github.com/zaahidali/algorithms-python","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/zaahidali%2Falgorithms-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaahidali%2Falgorithms-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaahidali%2Falgorithms-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaahidali%2Falgorithms-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zaahidali","download_url":"https://codeload.github.com/zaahidali/algorithms-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240327300,"owners_count":19784015,"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":["binary-search","binarysearch","bubble-sort","bubblesort","linear-search","linearsearch","python-programming","python3","searching-algorithms","sorting-algorithms"],"created_at":"2024-11-09T17:12:27.141Z","updated_at":"2025-02-23T14:29:47.814Z","avatar_url":"https://github.com/zaahidali.png","language":"Jupyter Notebook","readme":"# Bubble Sort and Searching Algorithms\n\nThis repository contains Python implementations of the Bubble Sort algorithm and various searching algorithms, including Linear Search and Binary Search.\n\n## Bubble Sort Algorithm\n\nThe Bubble Sort algorithm is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. The algorithm continues until the list is sorted.\n\n### Usage\n\nHere is an example usage of the Bubble Sort algorithm:\n\n```python\nl1 = [4,2,1,6,7,5]\n\nlsorted=True\nwhile lsorted==True:\n    lsorted=False\n    for i in range(len(l1)-1):\n        if l1[i] \u003e l1[i+1]:\n            l1[i],l1[i+1] = l1[i+1],l1[i]\n            lsorted=True\nprint(l1)\n```\n\nOutput:\n```\n[1, 2, 4, 5, 6, 7]\n```\n\n## Linear Search Algorithm\n\nThe Linear Search algorithm is a simple searching algorithm that sequentially checks each element in a list until a match is found or the end of the list is reached.\n\n### Usage\n\nHere is an example usage of the Linear Search algorithm:\n\n```python\nl2 = [5,4,7,8,9,3,2,1,11,14,198,412,25,6]\nsno = 6\nelement = -1\nfor i in range(len(l2)):\n    if l2[i] == sno:\n        element = l2[i]\n        print(\"The element \"+str(l2[i])+\": found at index: \"+str(i))\n        break\nif element== -1:\n    print(\"The element does not exist\")\n```\n\nOutput:\n```\nThe element 6: found at index: 13\n```\n\n## Binary Search Algorithm\n\nThe Binary Search algorithm is a more efficient searching algorithm for sorted lists. It works by repeatedly dividing the search interval in half until the target value is found or the interval is empty.\n\n### Usage\n\nHere is an example usage of the Binary Search algorithm:\n\n```python\nl = [2, 3, 5, 8, 11, 12, 18]\nsearch_for = 11\nslice_start = 0\nslice_end = len(l) - 1\nfound = False\n\nwhile slice_start \u003c= slice_end and not found:\n    location = (slice_start + slice_end) // 2\n    if l[location] == search_for:\n        found = True\n        print(\"The value found at index : \"+str(location))\n    else:\n        if search_for \u003c l[location]:\n            slice_end = location - 1\n        else:\n            slice_start = location + 1\nprint(found)\nprint(location)\n```\n\nOutput:\n```\nThe value found at index : 4\nTrue\n4\n```\n\nFeel free to explore and modify the code to understand the algorithms better.\n\n## License\n\nThis repository is licensed under the [MIT License](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaahidali%2Falgorithms-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzaahidali%2Falgorithms-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaahidali%2Falgorithms-python/lists"}