Giter Club home page Giter Club logo

Comments (4)

echosonusharma avatar echosonusharma commented on August 26, 2024

@prb01 if the needle (n) is ahead of the middle value (m) then low should be mid + 1. there's some mess up in the sudo code....ignore that.

if (value === needle) {
    return true;
} else if (needle > value) {
    low = mid + 1;
} else {
    high = mid;
}

from kata-machine.

jameszenartist avatar jameszenartist commented on August 26, 2024

@prb01 In addition, I recently noticed that he had set the initial value for hi as array.length. I've been looking for some good refreshers on algorithms lately, and I was always under the impression that it should be array.length - 1? Does that not matter?

-James

from kata-machine.

Agent-E11 avatar Agent-E11 commented on August 26, 2024

@jameszenartist I know this is over a year old, but I have an answer 🤣

hi is exclusive, so the code does not check the value at hi, only the values below hi

from kata-machine.

jameszenartist avatar jameszenartist commented on August 26, 2024

Hi @Agent-E11 , thank you for your reply!

Yes, that does make sense! -James

from kata-machine.

Related Issues (20)

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.