{"id":13767252,"url":"https://github.com/0xprinc/huff_BinarySearch","last_synced_at":"2025-05-10T22:31:39.177Z","repository":{"id":153620129,"uuid":"608762673","full_name":"0xprinc/huff_BinarySearch","owner":"0xprinc","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-08T16:07:48.000Z","size":292,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-01T10:02:27.071Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xprinc.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2023-03-02T17:26:47.000Z","updated_at":"2023-04-03T22:52:43.000Z","dependencies_parsed_at":"2023-05-22T06:00:43.212Z","dependency_job_id":null,"html_url":"https://github.com/0xprinc/huff_BinarySearch","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/0xprinc%2Fhuff_BinarySearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xprinc%2Fhuff_BinarySearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xprinc%2Fhuff_BinarySearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xprinc%2Fhuff_BinarySearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xprinc","download_url":"https://codeload.github.com/0xprinc/huff_BinarySearch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253492529,"owners_count":21916959,"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":[],"created_at":"2024-08-03T16:01:06.670Z","updated_at":"2025-05-10T22:31:36.940Z","avatar_url":"https://github.com/0xprinc.png","language":"Solidity","funding_links":[],"categories":["Huff projects you can learn from and contribute to"],"sub_categories":[],"readme":"This repository contains the implementation of binary search algorithm written in HUFF for EVM chains.\u003c/br\u003e\nGiven a sorted array, the Binary Search Algorithm searches for a specific element in a sorted list or array in an efficient way. \n\npseudo-code for binary search is as follows:\u003c/br\u003e\n                // we are gonna use the two pointer for this algorithm \u003c/br\u003e\n                // left pointer points the start of the array \u003c/br\u003e\n                // right pointer  points the end of the array\u003c/br\u003e\n                \n                while(left pointer \u003c= right pointer){   \n                \n                    // middle pointer will be the average of the left and right pointer\n                    middle  = left + (right - left)/2\n                    \n                    if(middle element == num){\n                        return middle index;\n                    }\n                    else if(num \u003e middle element){\n                        left  = middle + 1;\n                    }\n                    else if(num \u003c middle element){\n                        right = middle - 1;\n                    }\n                }\n\nI have also included the implementation of the binary search in solidity.\n\n\n# to-do list \n1. Optimising this contract \n2. Writing more test contracts \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xprinc%2Fhuff_BinarySearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xprinc%2Fhuff_BinarySearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xprinc%2Fhuff_BinarySearch/lists"}