{"id":21908760,"url":"https://github.com/mbn-code/rust-binary-search","last_synced_at":"2025-03-22T07:48:16.360Z","repository":{"id":218133758,"uuid":"745537675","full_name":"mbn-code/Rust-Binary-Search","owner":"mbn-code","description":"Rust Binary Search algorithm implemented with visual aid to show what the algorithm is doing. ","archived":false,"fork":false,"pushed_at":"2024-02-05T09:25:35.000Z","size":28,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-27T08:11:38.654Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/mbn-code.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,"dei":null}},"created_at":"2024-01-19T14:54:44.000Z","updated_at":"2024-01-22T22:38:59.000Z","dependencies_parsed_at":"2024-01-19T23:28:24.391Z","dependency_job_id":"df19a748-b57b-4b99-9496-3ff3b4fbda37","html_url":"https://github.com/mbn-code/Rust-Binary-Search","commit_stats":null,"previous_names":["collinedward/rust-binary-search","mbn-code/rust-binary-search"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbn-code%2FRust-Binary-Search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbn-code%2FRust-Binary-Search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbn-code%2FRust-Binary-Search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbn-code%2FRust-Binary-Search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbn-code","download_url":"https://codeload.github.com/mbn-code/Rust-Binary-Search/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244924753,"owners_count":20532873,"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-11-28T17:13:49.788Z","updated_at":"2025-03-22T07:48:16.337Z","avatar_url":"https://github.com/mbn-code.png","language":"Rust","readme":"# Binary Search Algorithm in Rust\n\nThis repository contains a simple implementation of the binary search algorithm in Rust, showcasing its functionality and providing a basic understanding of how the algorithm works.\n\nIf you don't want to look at the code or you don't have rust compiler installed and just wants to see what the program does go [Here](https://github.com/CollinEdward/Rust-Binary-Search/releases/tag/Rust) for the pre-compiled binaries\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [How to Use](#how-to-use)\n- [Code Explanation](#code-explanation)\n- [Benchmarking](#benchmarking)\n- [Press Any Key to Exit](#press-any-key-to-exit)\n\n## Introduction\n\nBinary search is an efficient algorithm used to find a specific value in a sorted array. This implementation demonstrates the binary search process with a visual aid, simulating real-time updates on the terminal during the search.\n\n## How to Use\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/CollinEdward/Rust-Binary-Search.git\n   cd Rust-Binary-Search\n   ```\n\n2. Run the Rust program:\n\n   ```bash\n   cargo run\n   ```\n\n3. Follow the on-screen instructions, and observe the binary search algorithm in action.\n\n## Code Explanation\n\nThe main Rust program (`main.rs`) contains two functions: `binary_search` and `main`. The `binary_search` function performs the binary search on the provided sorted array, while the `main` function initializes the sorted array, specifies the target, and calls the `binary_search` function.\n\n### Binary Search Function\n\n```rust\nfn binary_search(\n    result: Result\u003cusize, usize\u003e,\n    mut low: usize,\n    mut high: usize,\n    target: i32,\n    array1: \u0026[i32],\n) {\n    // ... (see code comments for detailed explanation)\n}\n```\n\nThe `binary_search` function takes parameters such as the search result, search boundaries (`low` and `high`), target value, and the sorted array (`array1`). It prints real-time updates about the search process, providing insights into the algorithm's steps.\n\n### Main Function\n\n```rust\nfn main() {\n    // ... (see code comments for detailed explanation)\n}\n```\n\nThe `main` function initializes the sorted array, specifies the target value, and calls the `binary_search` function. It also includes a simple benchmarking section to measure the elapsed time of the algorithm.\n\n## Benchmarking\n\nThe program includes a benchmarking section that measures the elapsed time of the binary search algorithm using Rust's `std::time::Instant` module.\n\n## Press Any Key to Exit\n\nThe program prompts the user to press any key to exit, allowing you to observe the results before terminating the program.\n\nFeel free to explore and modify the code to enhance your understanding of the binary search algorithm in Rust.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbn-code%2Frust-binary-search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbn-code%2Frust-binary-search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbn-code%2Frust-binary-search/lists"}