## Binary search and finding roots.

Binary search is one of my favourite algorithms. If you don’t know what it is, it is a searching algorithm with a logarithmic run-time and very simple logic, but it works only for sorted lists. Simply start in the middle element. If what you’re searching for is smaller then the middle element, go to the middle of the left side. If what you are searching for is bigger than the middle element, go to the middle of the right. Repeat this process until you find what you are looking for.

Surprisingly, this system can be used to find the square root of a number as we are searching for root in a sorted list of numbers on the number line. Suppose you want to find the square root of 9.

• The middle of 0 and 9 is 4.5.
• 4.5 squared is 20.25, not 9.
• 9 is smaller than 20.25, so the square root of  9 should be smaller than 4.5.
• 2.25, maybe? It is in the middle of 0 and 4.5.
• However, 2.25 squared is 5.0625.

If you repeat that process over and over again(which I refuse to do), you will eventually reach 3, which is the correct answer.

In fact, you can even do this for cube roots, fourth roots, fifth roots, et cetera. Instead of checking the square of your current number each step, check the cube of the number power of 4, power of 5, power of… you get it.

I even created a program to execute this function, with the same logic I just explained. Down here is the gist for the program:

## Behold: The Online 4 Hours programming website!

As you may know, I love programming. And now, I am working on a webiste dedicated to the programs I make. And guess what? It is also a part of Online 4 Hours!

I will be creating connections between programs on my new website, and posts on my blog. For example, I have a blog post on voting systems, and a program that calculates the winner in an alternative vote! I already have the link to the post on my website, and the link to the program on my blog.

The website is up, and if you would like visit, just use this link.

## Greek,Egyptian, and Hindu: The similarities in mythology.

I know the mythologies of many cultures. Greek, Egyptian, and Hindu mythology seem very far from each other, but there are many similarities between them which you may not have known.

Multiple gods

Okay, this is the most obvious similarity. I do find this interesting, though, for most religions nowadays believe in only one god, or none at all. However, these cultures saw the many different things that happen in the universe, and decided that one being could not have done everything

Order over chaos

Gaea and Uranus are born from chaos. The first island rises from the sea of chaos. The world and everything formed from chaos. Do you see a recurring pattern here? They all describe the very first thing in the universe, to be chaos. Surprisingly, they also describe chaos to be evil. The Egyptians called chaos Isfet, and described it as an evil force, constantly warring with Ma’at, or order. The Hindu god Shiva, an evil figure in most stories, was described to be the embodiment of chaos. Fact: Chaos is Greek for, the gap.  Nothingness.

Imperfection

Have you read Homer`s Illiad? Well, if you haven’t, there is a humongous war between the Greek city states and the kingdom of Troy. And you know what started it? A golden apple. In the middle of a huge wedding, The goddess Eris puts a golden apple on the table, with these words written: FOR THE FAIREST. It causes a giant argument between the goddesses, and kicks off a chain of events leading to the Trojan War. This comes to show that the Greek gods aren’t perfect, but is that trait exclusive to the Greeks? No. The world is lead to corruption for one mistake by the Egyptian god Osiris.  Indra’s pride results in the power of the Hindu Deva to vanish.  The list goes on. It is very strange to think that the beings who created everything are imperfect, and it adds a sense of reality to these otherwise myths.

It may sound crazy that there are similarities between the mythologies of three civilizations, completely isolated from each other, especially considering the major differences you can see at first glance. But hopefully, after reading this post, you will think in a different way.