• groet@feddit.org
    link
    fedilink
    English
    arrow-up
    3
    ·
    4 hours ago

    A Binary search requires a ordered data set. Something like "if you react to X, you will also react to any X+1, X+2… X+n. Food is not ordered, you cant know if you react badly to bell peper because you reacted badly to whole grain wheat.

    • veleth@lemmy.wtf
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      3 hours ago

      Not necessarily, but searching a data set that’s not ordered relies on an assumption that there’s a single thing you’re looking for.

      If there are 10 ingredients, you get sick and you only take half next time, you need to be able to assume that there’s one set of 5 that doesn’t get you sick and one that does, and so on until you get down to the last ingredient.

      It’s a good way to e.g. quickly find the right breaker in the box, because for each device/ socket there’s just one breaker that’s responsible, so flipping half of them gives you an actionable result