Finding Islands In a Binary Matrix

There is a problem that very often tends to pop up in a lot of technical coding interviews because the solution can be trivial if the candidate understands core concepts of computer science such as recursion and depth first search. It also reveals in-depth knowledge of graphs and common graph traversal algorithms. The problem statement is, given an NxN matrix which contains only 0's and 1's find the number of islands within the matrix. An island is defined as adjacent matrix cells containing 1's, where adjacent means horizontal, vertical and diagonal neighbor cells. In this article I present an efficient enough algorithm with O(n) complexity that takes advantage of a depth first search approach to quickly iterate through the matrix and recursively detect islands.

Read More

Algebraic Types in Scala???

If you have ever looked into Scala at any point you would’ve heard the term Algebraic Data Types

The goal here is to attempt to explain what that is since it’s kind of an obscure concept from an OO view point. Even though you could draw a parallel between algebraic types and Composition vs Inheritance, it’s not quite the same thing. So it’s worth while to try to understand ADT for what it is.

Read More

Why Is Everyone Talking About the CAP Theorem?

With all the hype and buzz around micro services and containers and APIs and  (insert buzz word here) many in the industry are talking about the CAP theorem. It seems like every software engineer is expected to know what it is all of a sudden. OK, that maybe an over exaggeration, clearly if you're not building distributed applications you won't have a clue as to what I'm ranting about here... But lets face who isn't writing distributed applications these days? 

Read More

My Experience with C# as a Java Guy!

So, the age-old question, Java vs. ‘fill in the blank’. If you are a java developer (sorry Engineer), then you love Java, and you spend time arguing with co-workers about why Java is better or at least not worse than their language of choice. These arguments never end, and will never end, that’s because there are so many languages out there and every month some new language is created which is claimed to be the solution to all our problems. 

Read More