
Teaching basic Algorithms can be one of the most challenging parts of introducing someone to Computer Science. Between the hypothetical problems and abstract thinking, it can feel overwhelming.
But it doesn’t have to be.
Unpopular opinion: Any strong thinker can develop a strong solution to a basic algorithmic question if you frame the question properly.
Don’t believe me? Try this out on a friend. I bet that by the end of it, they will develop an algorithm for Binary Search, and understand the concept, even if they have no technical background.
The Binary Search Problem… In the Conventional Sense
Here is the definition of Binary Search given on Geeks for Geeks: "Given a sorted array arr[] of n elements, write a function to search a given element x in arr[]."
I study software engineering and even I get a headache when reading that. If you use that language, I guarantee it will in one ear, and out the other.
So just don’t do it.
Framing a Binary Search Problem for your Non-Technical Friends
Framing the problem is half the battle. Do it properly, and the chances of success are so much higher.
The Egg Dropping Problem
If you want a less technical way of asking the binary search problem, this is a great way to approach it.
"Imagine you have a big huge carton of identical eggs and you want to find out how strong your eggs are. You work on a 100-floor office building, and you want to find the highest floor that you can drop the egg without breaking it. How can you do this as fast as possible"
While you don’t have to follow it exactly, there are some tips that you should keep in mind when framing the problem.
Tip #1: Stop Talking Code
Communicate the problem as if it has nothing to do with Programming
To the non-technical person, Computer Science is terrifying. Believe me, I know. There was a time when my knowledge of Programming was the clickity-clack hacking they show on TV shows. I have definitely been the one giving a blank stare at someone explaining what a program or algorithm is.
As a software developer today, I realize that programming is actually way simpler than it seems at first glance. Syntax is misleading.
If you’re a strong thinker you can come up with great algorithmic solutions, regardless of your technical background.
So my advice? Don’t talk code. Don’t act as if this is a programming question. It will just freak them out.
Tip #2: Take advantage of common knowledge
"Imagine a list of strictly increasing integer values…" and blah blah blah blah blah. Information overload. Ya same. Here is my advice: Don’t explain. Let common sense do the work for you.
Yes, binary search requires the list you are searching through to be in a certain order and directionality, but you don’t have to say it in as many words.
Use what we know for the real world
By using a building analogy, I framed the problem in a way that every potential value (floor number) is a strictly decreasing interval. And it was done using non-tacit, unconscious knowledge from the real world.
Everyone knows that if you drop something, gravity will pull it in one direction – down. And through common sense, people know that if you can drop something from a certain floor without it breaking, you can also do it at all lower floors.
Nine times out of ten, common sense can explain a problem better than we can. Take advantage of it. After all, everyone would rather solve a problem that actually seems to have real-world, imaginable applicability.
Tip #3: Avoid Over-Technical Jargon
Ok, we get it. You’re a software engineer or math major and you like your fancy words. But like any other field, the jargon you throw around on a daily basis means next to nothing to anyone non-technical. Just like a surgeon dumbs down their procedure when explaining it to patients, try to avoid jargon unique to the CS field.
Remember, you’re trying to teach someone a concept, not show off your expertise or teach them technical terms.
Rule of thumb, if you’re using jargon, it’s too technical.
Avoid words such as "critical"
While "critical value" might mean a lot in the algorithm world, most non-technical individuals will find this unclear. You’ll notice instead of saying "critical floor", I just asked for the highest floor.
Use plain English. It’s all about speaking in a language they understand.
Yes, you can define the word critical, but what’s the point. It is unnecessary for the problem, and it just adds another tidbit of information that distracts from the problem. Just skip any words that require unnecessary definitions altogether. Please.
Don’t use arbitrary numbers
You’ll notice that I framed the problem with 100 floors, instead of the n floors so commonly used in a binary search problem.
Computer scientists may be used to seeing the "n" in every problem ever as a way to generalize sizes in a problem, but most people think "n" is just a short form for "no" in a questionnaire. And while problems framed with arbitrary values may be beneficial for generality, the arbitrary values don’t change the essence of the problem.
If you want someone to understand a problem, give them a nice round REAL number as a starting point so they can wrap their heads around the problem. Arbitrary numbers are hard to conceptualize.
Let them focus on the problem at hand, not the visualization of the arbitrary value ‘n’.
Don’t use generalize unless it is absolutely necessary
Solve the problem first, then generalize as needed. This is my tip for solving any algorithmic problem, but it is especially important if you are talking to someone without a technical background
Tip #4: Put yourself in their shoes
Be patient
Be the interviewer you always wanted at a job interview. Not in the sense that you’re judging and evaluating, but in the sense that you give prompting questions when needed.
No one likes sitting there with no clue where to go next. It’s frustrating, it’s embarrassing. Just like good interviewers do when you’re stuck on a whiteboarding problem, if someone gets stuck, help them.
Ask them a question that points them in the right direction. Or if their solution is wrong, instead of telling them point-blank, give them a scenario where their solution is not optimal. Let them think through it. Be patient.
For once, don’t think like a programmer
Put yourself in the shoes of someone who has no technical background, and have fun asking people to solve the egg dropping problem.
You’ll be shocked by how many people can solve an algorithm when they think it has nothing to do with programming.
Have fun. And you never know, maybe you’ll end up showing someone that coding isn’t as daunting as it seems.
If you enjoyed reading, join my journey by subscribing or becoming a Medium member. You can also support my writing by buying a coffee ☕️!