Gaurav's Blog

Exercises on Probability & Chernoff Bounds

Chernoff Bounds is a great tool that we learnt in CSE638. The foundation for which was laid with the great Balls-and-Bins stuff we did in CSE548.

Here are some exercises for Chernoff Bounds and Probability.

Read more

Longest Palindromic Substring in Linear Time

We know that we can solve this problem using Suffix Arrays and Suffix Trees in Linear Time, but its not all that nice. I will probably like to implement the components of those some time. But there is a much nicer and simpler algorithm, called “Manacher’s Algorithm” that I had known, but never bothered reading up on. Dhruv, today shared a link which explained it brilliantly. Here it is.

I will try to solve NUMOFPAL on SPOJ using Manacher’s. I might also do EPALIN, which I already did earlier using an approach similar to Karp-Rabin.

Update: I solved NUMOFPAL using Manacher’s.

Read more

git blame

Yesterday, I came to know about this wonderful git command. What it allows you to do, is to track who wrote a particular section of a file.

reddragon@reddragon-laptop:~$ git blame -L 150,+5 decaf.yy
24d48281 (Gaurav Menghani 2012-03-21 19:28:31 -0400 150) ClassDeclarations:
efe4b77c (Dhruv           2012-03-28 18:08:03 -0700 151)     ClassDeclarations C
d25802c5 (Gaurav Menghani 2012-03-28 21:17:15 -0400 152)         $1->push_back($
efe4b77c (Dhruv           2012-03-28 18:08:03 -0700 153)         $$ = $1;
efe4b77c (Dhruv           2012-03-28 18:08:03 -0700 154)     }
Read more