DEV Community

Dragos Vecerdea
Dragos Vecerdea

Posted on

How I got to understand binary search

Photo of a book

Not long ago, while interviewing for an internship position, I was asked one of the most abstract and surprising technical questions I have ever been asked in an interview:

' How would you teach a 7-year-old child binary search?'

Alongside the obvious purpose of verifying my ability to articulate complex ideas using simple words, the question made me reflect on something else: all the great Eureka! moments I had so far when understanding a concept that seconds before seemed so hard to comprehend.

I asked myself further, what do those moments have in common? Where does the talent of transforming simple words into complex ideas live?

I suddenly remembered myself, how I was thought binary search, by a very talented schoolmate, almost a decade ago. She grabbed a thick book, I recall... and asked me how I would find page 256 in it. At first, the question did seem odd, as I used to find a page in a book by picking a place to open it at and then turning pages from there. She then opened it to the half and showed me the page number: 273. The things were already starting to fall into place. She then followed her plan to the end by opening the book to the half between the first page and the 273rd page. It was by that moment, that the idea behind binary search was in my mind and nothing could have blurred it anymore. Not only that it made sense but it felt real and all around me.

Since the interview, I happen to ask myself more often, how would I explain a hard technical concept to someone outside my field of research?

Too often, we get blocked behind the walls of technical words, missing the beauty of simplicity. Feel free to share your own Eureka! moments and tell us a story about finally understanding a difficult topic and what do you think made it possible. Was it a person, a place, a good example or something else?

Top comments (0)