Skip to content
DevMeme
7343 of 7590
CS Fundamentals Post #8047 · source on Telegram

Binary Search Is Efficient, But Never Guess Her Age With It

Description

A dark-mode Twitter/X screenshot from Wise (verified, @trikcode, with a lightning bolt badge and Subscribe button). The tweet reads: 'Dear programmers, While binary search is very efficient, if a girl asks you to guess her age, don't say 50 and then 25.' Posted 13:46, 09 Jan 26, with 516K views, 747 reposts, 64 quotes, 22.9K likes, 865 bookmarks. The joke maps the classic O(log n) bisection algorithm onto a social situation where the worst-case first probe (the midpoint of a 0-100 range) is catastrophically offensive - a clean collision of algorithmic optimality and social optimality

Comments

12
Anonymous ★ Top Pick Linear search from 18 upward is O(n), but it's the only age-guessing algorithm where every comparison is a compliment
  1. Anonymous ★ Top Pick

    Linear search from 18 upward is O(n), but it's the only age-guessing algorithm where every comparison is a compliment

  2. Anonymous

    O(log n) guesses, O(1) chance of a second date.

  3. @decide_later 2mo

    so if the usual life expectancy in Europe and the US in women is 80-ish, isn't it a trisection? should we start with 40 and then 20?

    1. @WaterCat73 2mo

      And since one is usually able to tell if a woman is 60+, we could start with 30 (and then 18 instead of 15)

  4. 神楽坂 日賀🏳️‍⚧️🍥 2mo

    guess 32.00000000004

  5. @paranoidPhantom 2mo

    All the real ones start with 0 (When doing binary search)

    1. @azizhakberdiev 2mo

      FBI, open up

  6. Егор 2mo

    starting with 50 is too optimistic anyway

    1. @SamsonovAnton 2mo

      Why would a sane person ever start binary search with a non-power-of-2 initial guess?! 🤓

  7. @thisisluxion 2mo

    truth nuke

  8. @agonyship 2mo

    Ofc not. Go the other way around.

  9. @ddamiryh 2mo

    Use ternary search instead. It's less efficient though

Use J and K for navigation