GithubHelp home page GithubHelp logo

amirallami-code / binary-search-algorithm Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 175 KB

This repository contains an implementation of the binary search algorithm. This efficient algorithm is designed to find an item from a sorted list of items. It does so by repeatedly dividing the list in half until the possible locations are narrowed down to just one.

Home Page: https://binary-search-algorithm.vercel.app

JavaScript 61.67% HTML 14.99% CSS 23.35%
javascript js binary-search-algorithm algorthims binary-search-tree

binary-search-algorithm's Introduction

Overview

This repository contains an implementation of the binary search algorithm. This efficient algorithm is designed to find an item from a sorted list of items. It does so by repeatedly dividing the list in half until the possible locations are narrowed down to just one.

How does this algorithm help us?

The binary search algorithm helps us find numbers, letters, words, or any other items as quickly as possible. This code is specifically designed for searching numbers and can find them in the fastest way without taking a number from the user.

How does binary search work?

Imagine you have a thick phone book. Each page has several entries of names, followed by the person’s phone number next to it on the same line. All the names are sorted in alphabetical order, so “Aaron” appears before “Andy”. How would you go about searching for someone named “Steve”?

You’ll start by flipping the book to the middle and see what the first alphabet of the first name on the left page is. If it’s a “G”, and because you know that “S” comes later in the alphabet than “G”, you’ll flip to the middle of the right-half of the book, and repeat the same evaluation again until you find a page with names starting with “S”.

That, in essence, is the binary search algorithm. You halve a list, discard one half and continue searching through the remaining half, until you arrive (or not) at the value you’re searching for. Voila! You found what you wanted without iterating from the first item through to the last in the list - spending much less time for the same result.

Preview

go to this link and see the preview of this project online

https://binary-search-algorithm.vercel.app

Installation & Usage

Clone this repository to your local machine using

git clone https://github.com/amirallami-code/binary-search-algorithm.git

It’s very simple to use. Answer the questions. Remember, if you answer even one question incorrectly, the output will be different and it won’t find your number!

Contribution

We welcome contributions from the community. If you wish to contribute:

  • Fork the project.
  • Create your feature branch (git checkout -b feature/AmazingFeature).
  • Commit your changes (git commit -m 'Add some AmazingFeature').
  • Push to your branch (git push origin feature/AmazingFeature).
  • Open a pull request.

License

This project does not have any license.

Contact Information

If you have any questions or concerns about this project, please contact us at [email protected]

I hope this helps! Let me know if you have any other questions.

binary-search-algorithm's People

Contributors

amirallami-code avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.