Notifications
Article
Software - How does a computer communicate
Updated 17 days ago
13
0
Reds and Greens
Imagine you were in a box.
There is a small hole in the box, large enough to slide out a piece of paper.
Beside you in the box is a stack of red paper, and a stack of green paper.
I could ask you a question and you could push through that hole one of the two kinds of paper. Red means no. Green means yes.
It is a hard thing to imagine, but even in those constraints, we could eventually work up to having infinitely complex conversations.

We can start with simple “yes or no” question.

Do you like dogs?
Do you like pineapple on your pizza

Then we could move to you explaining words.
What is your name?
I could start saying every letter out loud, then you would put a red piece of paper through every time. Then when you want to pick a letter you put a green one through.
lets try that again:
ok, so the name is "ED", slow going, but possible. Let's try another question,
What age are you?
you know what, maybe not. we could be here a while.
lets try something different
Are you older than 100?
Are you older than 50?
Are you older than 25?
35?
37?
Ok, you are 36!
It took some time, but we got to the number 36 after only 6 questions, instead of counting all the way.
That was a simple example of the difference between a "Linear" search algorithm (each item one by one) and a "Binary" search algorithm. We half the problem each time, simplifying the work we have to do.
now that we are talking comfortably in binary, the next question is, how do we move onto more complicated conversations?

Tags:
Jason Storey
Software Developer and Contractor - Programmer
7
Comments