{"id":22325084,"url":"https://github.com/rogercoll/rbinarysearch","last_synced_at":"2025-03-26T05:44:01.515Z","repository":{"id":113987555,"uuid":"119959852","full_name":"rogercoll/rBinarySearch","owner":"rogercoll","description":null,"archived":false,"fork":false,"pushed_at":"2018-02-05T13:59:07.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-20T14:52:51.785Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/rogercoll.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":"2018-02-02T09:14:52.000Z","updated_at":"2018-02-03T13:02:23.000Z","dependencies_parsed_at":"2023-03-13T13:09:51.007Z","dependency_job_id":null,"html_url":"https://github.com/rogercoll/rBinarySearch","commit_stats":{"total_commits":2,"total_committers":2,"mean_commits":1.0,"dds":0.5,"last_synced_commit":"a2cafee58a5e100268865c6d109ef3668c76f174"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogercoll%2FrBinarySearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogercoll%2FrBinarySearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogercoll%2FrBinarySearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogercoll%2FrBinarySearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rogercoll","download_url":"https://codeload.github.com/rogercoll/rBinarySearch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245598310,"owners_count":20641884,"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-12-04T02:10:07.934Z","updated_at":"2025-03-26T05:44:01.497Z","avatar_url":"https://github.com/rogercoll.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Binary Search\n\n\u003cbr\u003e\n\n[![Status][status-image]][status-url]\n\n\u003cbr\u003e\n\n\n\u003e Basic binary search implementation that works with integers and string. Also known as dichotomic search problem. The first r, is because of the recursive implementation of this algorithm.  \n\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; if they are unequal, the half in which the target cannot lie is eliminated and the search continues on the remaining half until it is successful. If the search ends with the remaining half being empty, the target is not in the array.\n\nBinary search runs in at worst logarithmic time, making O(log n) comparisons, where n is the number of elements in the array, the O is Big O notation, and log is the logarithm.\n\n### Requirements\n\n- Npm and Nodejs\n\n### Installation\n\nWorks with any Nodejs version:\n```\nnpm install rbinarysearch\n```\n### Usage\n\nBasic example:\n\n```js\nvar rvector = require('rbinarysearch');\n\nvar test = new rvector();\nvar values = [1,-2,13,4,5,6,7,23,9,0]; //Can also be a strings vector ex: [\"hi\",\"abc,\"roger\"]\n\n//Adding values\ntest.addElems(values);\ntest.addElems(6); //\"hello\" if its an array of strings\n\n//Deleting elements\nvar aux = [9,-2,23,13,123,0];\ntest.deleteElems(aux);\ntest.deleteElems(6);\n\n//Binary Search\nvar pos = test.binarysearch(13); //if array of strings \"roger\"\nconsole.log(pos);\n\n//Info\nvar actual_array = test.getvec();\ntest.printVec(); //it's a console log of the array\n\n```\n\n\u003c!-- Markdown link \u0026 img dfn's --\u003e\n[status-image]: https://img.shields.io/badge/Status-200-brightgreen.svg?style=for-the-badge\n[status-url]: https://en.wikipedia.org/wiki/Binary_search_algorithm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frogercoll%2Frbinarysearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frogercoll%2Frbinarysearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frogercoll%2Frbinarysearch/lists"}