A Simple Explanation of Rabin-Karp Algorithm For String Search

Introduction If you are new to string search, I would recommend to first read the brute force approach here. Brute force as discussed in the mentioned post has time complexity of O(mn) in worst case. Rabin-Karp also has the worst case time complexity of O(mn), but it has a much better time complexity of O(m... Continue Reading →

A complete tutorial on Binary Tree

Introduction   Figure 1 shows a Binary Search Tree. This post will start with the motivation of studying BST and gradually move to the related definitions. We will do some hands on coding for simple BST operations and we will end the post by analysing the drawbacks. Where do we use Binary Search Tree? Trees... Continue Reading →

Huffman Code – An example of Greedy Algorithm

Introduction A greedy algorithm always makes the choice that looks best at the moment. It makes a locally optimal choice in the hope that this choice will lead to a globally optimal solution. Greedy algorithms do not result in optimal solutions always but for many problems they do. A problem can be solved by Greedy... Continue Reading →

Up ↑