In this post I wanted to discuss about how to evaluate time complexity , space complexity of a given problem.
Problem: Given two arrays of size N. find the common elements between them.
To solve this we need not to write a piece of code, compile it. Run it. We simply say its 2 elements that got repeated (5, 10)
But what if there are 1 billion elements and we are asked to search. Then definitely we go for some automation. That is where we implement some ideas to do it some logical way.
Algorithms can be said to be an idea to solve a problem. But not all ideas are really algorithms. It has to be systematicaland has to solve the problem in finite interval of time. No matter its in seconds or days or years.
For the above problem to solve we go by Brute…
View original post 1,043 more words