How to decide which solution is best for arrays based on Time & Space Complexity

Good read


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


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s