Solving the Water Jug Problem

Ever played one of those games where you are given two water containers/jugs of different sizes and the task is to fill one of the jugs with a certain amount of water? Here’s an android app (image below) for the game if you aren’t familiar. Play it all you want because now I’m going to ruin it for you! I’m going to tell you a general solution to this water jug riddle.

waterlogic

The only thing you need to know is: Greatest Common Divisor.

Continue reading

Advertisements

Trek to SavanDurga

Here’s my long due post about the trek to SavanDurga which I went for in late December last year. My primary reason for not writing about it is as usual, laziness but the other reason, which inspires the laziness in this case is: What can I tell you about a Trek to SavanDurga which the others posts about it can’t? And there exists too many of them. In fact, that’s what prompted the trip in the first place. When I couldn’t think of the answer, I dropped the idea. But today, while searching for a destination for  a one day trip in/around Bangalore, Savandurga came up. While we were discussing what all we could do tomorrow, trekking being one option, I started remembering Savandurga and thought of finally writing this post too.

s2

Continue reading

Is it worth it?

What will happen by studying all this math, computer science? Why am I studying?

The world today is suffering from a million problems. Hunger, poverty, cruelty, discrimination, diseases..

How is my studying of computational science going to impact the world?

So what if we are able to produce machines that are capable of doing things that they weren’t able to do 6 months ago? Continue reading

Understand Git and Github

This article has been published at Function Space.

(This is just my back up copy of the thing, do check this out on FS for better experience.)

Let’s say for an upcoming contest at a school, you form a team and decide to develop a software. Everything goes fine until you guys come to a stage when two or more of teammates work on the same piece of code! If you guys are working on disjoint set of files, the problem comes when you want to integrate the two modified code together manually.

Further, how would you handle a vast code distributed over several files and people working from different geographical locations? If one of the guy messed up the code, won’t all of the other teammates also suffer? The solution is a version control system. In this article, we will discuss about one of the widely used open-source version control system called git.

Continue reading

Complexity Zoo

This article has been published at Function Space.

(This is just my back up copy of the thing, do check this out on FS for better experience.)

In this article, we dive into computational complexity theory. You might want to check out our previous article to get informally introduced to some of the concepts that we elaborate here, although it is not a strict requirement.

Let’s look at a few similar looking problems :

  1. Given a graph, can you find if it has a cycle?
  2. Given a graph, can you find if it has a cycle which covers each vertex exactly once?
  3. Given a weighted graph, can you find the shortest cycle which covers each vertex exactly once? Continue reading