Object Oriented Software – GOF Design Patterns

Softwares are susceptible to change. A new requirement can come-up any time and the software should be able to handle this change effectively with minimum intrusion. A software that is well designed can easily adapt to these ever-changing requirements and hence a good design is of utmost importance especially when it comes to design and development of a commercial software.
Continue reading “Object Oriented Software – GOF Design Patterns”

C++ – Be wary of strcat() and strcpy()

strcat() and strcpy() are two functions that work with the c-style strings. While the former concatenates two strings, the latter copies one string into the other. Both these functions have been the reason for multitude of bugs in many applications. Although, they are simple functions to use, most programmers are oblivious to their implementation details which has resulted in quirky and hard-to-debug behaviors in several applications .
Continue reading “C++ – Be wary of strcat() and strcpy()”

Algorithms – Optimizing nth Fibonacci Number

Let me make it clear beforehand. Don’t misinterpret the heading. I am not going to talk about the Fibonacci optimization technique using memoization and DP where you  store the result of sub-problems to make the algorithm faster. That’s the old school optimization technique which has a time complexity of O(n) and an equivalent space complexity. There is an even better optimization technique which I came across in one of my graduate classes (where I am a student:D).  I will be talking about a new way of representing the Fibonacci series which will help us compute the results way faster than the other techniques.
Continue reading “Algorithms – Optimizing nth Fibonacci Number”

Algorithms – Dynamic Programming

I have been coding for some time now and yet, I feel confused when I get into a discussion about the core algorithmic concepts. I still can’t figure out if a problem needs a Dynamic Programming solution, or if its needs a divide and conquer treatment or if it should fall under a different category.  This article is just an attempt to convey my level of understanding of the intuition behind Dynamic Programming. Feel free to weigh in!.
Continue reading “Algorithms – Dynamic Programming”