Algorithms in Life

DHARA DOSHI
Mar 3, 2017 · 5 min read

Find the perfect partner, apartment and job.

Oh really? Algorithms? Read On.

When choosing a life-partner, job or an apartment: We either stop too early or don’t stop early enough(due to FOMO). And every time we make these bad decisions we cringe inside a bit. That’s why what I will share, might make you feel better.

In your mind, you must be thinking “ Is this lady kidding! Does she really have the answers to the three most important problems in the life of a twenty(or thirty)something?”.

Well, I do! From the field of Computer Science — I have the Secretary problem for you and it’s solution, optimal stopping. Before you roll your eyes and move on, just hear me out.

What is the Secretary Problem?

An executive is looking to hire the perfect, hard-working, able Secretary. The time she would look for a secretary was the time she wasn’t actually working. But if she selected any candidate who later turned out unworthy, it would be a failure too. So selecting the best candidate for the job is of utmost importance.

The problem has certain rules:

  1. The total number of applicants ’n’ would be known.(If you have a time frame, you can deduce this n from it)
  2. The decision to accept or reject the candidate was to be made immediately after the interview. The candidates came in their own time — those were not like the recruitment of today where they call in huge numbers on the same day(at least that’s what happens in India). So you couldn’t look at all the candidates and make a decision at the end.
  3. The objective of the solution is to have the highest probability of selecting the best candidate of the whole group.

The Solution : Optimal Stopping

Optimal Stopping suggests looking at 37% candidates of n, and then taking a leap of faith with the first person who’s better than the best of the 37% you looked at. The probability of success in finding the best candidate is at least 37%. But, this is under ideal conditions.

Real Life is brutal and random and has a mind of it’s own : there are rejections and refusals.We should prepare for them.

The Post-Doc problem solves for this situation with a probability of 25%: In this, we pick not the best but the second best because it’s assumed the best is going to Harvard.

When n is large, we can employ an alternative solution- to decide your benchmark use sqrt(n) instead of .37*n . This reduces the number of interviews even further but the probability of finding the best candidate is slightly lesser.

Phew! Was that information overload! To augment your understanding check out this cool video which isn’t so cool after all ;). You’ll know what I mean once you watch it.

Disclaimer: It’s about choosing a clean toilet(which is sometimes tough to find in crowded places)

Let me keep my promise and help you now. I know you’ll want social proof. And I will hand it over to you.

Finding Love

No pursuit is as passionate and as hard as this one. Just wait till you hear Kepler’s story. Who Kepler?(You might be wondering). This guy Kepler. A famous astronomer, he is famous for the laws of planetary motion.

Kepler’s despair

When his wife died in 1611, he was in search of another soulmate. For 2 years, he dated 11 women. Some were not a good match, others(4th, 5th and 6th) he didn’t commit to because he had FOMO(I think!). He wanted to check out others before committing. To his despair, the efforts didn’t pay off. He was heart-broken and lamented this phase of utter heart-ache.

FOMO, this word is the best:) Don’t you agree?

Applying the Secretary problem:

Had Kepler applied the 37% rule to this problem, he would have selected the 5th lady as his lady love.

Life doesn’t follow the constraints of the Secretary problem, and thank God for that. He finally married the 5th woman(in a stroke of luck) and they had a very happy life ahead. But had he followed the Secretary problem at the beginning of his journey, he could have saved himself the emotional turmoil of the 6 later dates. (Few will disagree with this line of thought, I am sure ;) )

When to settle down?

When applying the Secretary problem, we have to decide on an “n” which in this case will be from age 18 to 40. The time to start getting serious would then be at age 26. You will need to adjust this age depending on real-life where there are refusals as well as the option to go back to an earlier prospect.

I can see my single close friends glaring at the number 26 and hating me for putting out this number. To my beloved friends I will say, don’t be obsessed with this number. Real-life can’t be modeled exactly into a Secretary problem. Rather use it as a guideline, a framework which you can employ in times of doubt. For example: If you have 2 years to find a partner, decide just after the first 37%(.37 * 2* 12 (months)= 8.8 months). Taking real-life scenarios, you can start at 5–6 months approximately(due to rejections).

Finding an Apartment or a job

My dear friend, Apply the Secretary problem and find yourself a warm cozy apartment and a brilliant job.

You might be aghast that I bundled finding love in the same category as finding an apartment(even I am, being a hopeless romantic ).

Hey, Come On! Whatever works right? I am sure, you will send major love my way, when you do use the 37% rule for a maddening apartment search which was so hair-pulling, you thought you would lose all your hair. OK, I am going to stop! It ain’t that funny either! Don’t hate me.

Here’s proof it works

If the Secretary problem fascinates you and intrigue you to learn more algorithms you can use in real life, check out Algorithms to live by. This awesome book is the inspiration behind this post.


Please hit the heart symbol and recommend this article if you liked what you read. It’s great encouragement for a new writer.

If you would like to read more of my work, Join my email list through the box below.

TechbasiCS

Thanks to Rahul parashar

DHARA DOSHI

Written by

Computer Science Addict, Software Engineer, Philosopher, Avid Reader, Lover of learning, Optimization Freak.

TechbasiCS

Thoughts about Computer science, tech and being in the software industry. Be ready to be motivated!

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade