Engineer Blog #3
Find the square root of a number, without using an inbuilt square root function.

Today's attempt, from scratch, took me 30 minutes. Reminder that my bar is 10 minutes per easy.

Here is my rationale:
- A square is a side, into a side. Literally!
- Every number can become a square by multiplication. So finding a number's square is easy.
- Finding the root involves squaring everything, until we get the desired number. Not so easy.
- Probably a cryptographic clue, here.
- Line 9 takes care of non-obvious squares
- 8 - it's 2 x 2 x 2, so it's not even a square. But, the closest squareRoot for 9, is 3, which is just 1 above 2, squareRoot for 4. Overstepping and having an extra number, via line 6, once reduced by understepping, becomes the exact number we need.
- There's no need to round it down, again.
- In case the number is a normal square like 16, we won't overstep by 1, so no need for line 9.
- Ran into time limit exceeded.
I think the time complexity is o(N)
, but that's too much, apparently.

Time complexity is o(N)
because I square every number in the world before N
, to reach N
.
Will try dividing it next time......Maybe, diving it by a certain number will give me o(log(n))
time.
8 is half of square(4)
and 2 x square(2)
.
Also, maybe there's something between square
, and log algorithms
, that can be used in association with each other.

Random
Every time I meet the kids of my siblings, I will make sure the conversation starts like this:
Me: Hi!
Do you remember me?
I met you when you were cranky, tired, and border-line puking, while I was busy with events.
I was very stressed.
Then, I told you my name, and your parents patiently explained to you how I was related to you.
..........Remember me, yet?
No?
Yes or no?
5 year old child, barely of literate age: Sorry sir.....Please don't judge me. I don't remember.
Please!
I am only 5 years old.

I don't want to pass on my karma, but this kind of karma is too good to pass up.

.....No, better not.
It's far too cruel to ask a child to remember an uncle's name just because he happened to be related to their parents, for 5 seconds of conversation in baby time.
In the comedic spirit of Zarna Garg, we will spend 20 seconds, to increase their chances of remembering us oldies.
God knows what the next generation will say about me - I don't want to tempt fate anymore.
Child: Dad, did you break the 100 meter world record?
Really?
Did you bounce your way to victory?
Me: This is karma.
Member discussion