{"id":20195254,"url":"https://github.com/amssdias/python-binary-search-algorithm","last_synced_at":"2025-07-09T04:05:57.318Z","repository":{"id":128478812,"uuid":"355915342","full_name":"amssdias/python-binary-search-algorithm","owner":"amssdias","description":"Binary Search Algorithm","archived":false,"fork":false,"pushed_at":"2021-04-08T13:22:08.000Z","size":1,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-09T04:05:56.910Z","etag":null,"topics":["algorithm","binary-search"],"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/amssdias.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":"2021-04-08T13:19:30.000Z","updated_at":"2022-08-24T09:55:44.000Z","dependencies_parsed_at":"2023-03-20T15:17:55.735Z","dependency_job_id":null,"html_url":"https://github.com/amssdias/python-binary-search-algorithm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amssdias/python-binary-search-algorithm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amssdias%2Fpython-binary-search-algorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amssdias%2Fpython-binary-search-algorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amssdias%2Fpython-binary-search-algorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amssdias%2Fpython-binary-search-algorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amssdias","download_url":"https://codeload.github.com/amssdias/python-binary-search-algorithm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amssdias%2Fpython-binary-search-algorithm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264390708,"owners_count":23600562,"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","binary-search"],"created_at":"2024-11-14T04:16:34.859Z","updated_at":"2025-07-09T04:05:57.304Z","avatar_url":"https://github.com/amssdias.png","language":"Python","readme":"# Binary Search in Python\n\nIn computer science, binary search, also known as half-interval search, logarithmic search, or binary chop, is a search algorithm that finds the position of a target value within a sorted array. Binary search compares the target value to the middle element of the array.\n\n## My solution\n\n```python\nfrom math import ceil\n\ndef binary_search(array, item):\n    if len(array) == 0:\n        return \"No items in the list\"\n\n    half = ceil(len(array) / 2) - 1\n\n    if array[half] == item:\n        return f\"Found item: {item}\"\n    elif item \u003e array[half]:\n        new_list = array[half + 1:]\n        return binary_search(new_list, item)\n    elif item \u003c array[half]:\n        new_list = array[:half]\n        return binary_search(new_list, item)\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famssdias%2Fpython-binary-search-algorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famssdias%2Fpython-binary-search-algorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famssdias%2Fpython-binary-search-algorithm/lists"}