Posts

How to Run OR Debug Map Reduce algorithm using eclipse IDE, without installing Hadoop & HDFS on Windows OS.

This guide is intended for anyone who is looking for an answer to any of the following questions: How do I create/run/debug a MapReduce project using Eclipse IDE? How do I Run MapReduce locally without installing Hadoop & HDFS? How do I run the same on windows OS? Prerequisite: Eclipse. JDK Installed. Cygwin installed. Hadoop-jars (Download from  here ) Problem statement: In a Mobile banking application, Bank sent the Push notification using GCM to each customer and encouraged them to share their user experience about the app on a scale of 1-5 stars. If user gives rating below 3, Then will be asked for feedback about how to improve user experience.now, bank wants to perform statistical analysis on basis of this huge data collected. Below are the logs excerpted from file,  Above logs provides fair idea about customerID |User Rating | User Feedback | City. Solution : Let’s now try to understand how Map...

Longest Increasing Subsequence (LIS):

Image
Problem statement: Our aim here is to find out longest increasing subsequence from the given sequence/array of integers. Note that the increasing subsequence need not to be continuous. Let’s trace below scenario, If the original sequence is {15, 27, 14, 38, 26, 55, 46, 65, 85} then, possible increasing subsequence would be, Original Sequence. (Input) Increasing Subsequence. (output) Length 1. {15, 27, 14, 38, 26, 55, 46, 65, 85} {15, 27, 38, 55, 65, 85} 6. 2. {15, 27, 14, 38, 26, 55, 46, 65, 85} {14, 26, 46, 65, 85} 5. Approach: We can solve this problem using dynamic programming. I’m going to create two arrays. One to store reference of previous element(arr1), another will store temporary sequence of increasing elements(arr2). Case-I. Append current element to the subsequence only if the previous element is smaller than the current one. (Note: Current element is the element at the i th ...

BFS to solve 'Snake and Ladder' Problem.

Image
Howdy folks! Thank you for visiting my blog once again. 😊 Today, let’s implement another interesting algorithm, that is Snake and Ladder board in Java. Consider below snake & ladder board, fig.1 Problem Statement: In above board, there are 100 cells. Considering player has a full control over a dice he throws. write an algorithm to find out minimum number of throws required to reach to the last cell which is 100 th cell from the 1 st cell. Approach: Let’s convert above board into a graph (Unaware about graph DS? click on mypost ) having 100 nodes. Each node is connected to maximum 6 nodes as dice has maximum six numbers. In between if I have the ladder then the top of ladder node is directly connected to the source node. So, in our board Node -1 is connected to the {2,3,4, 25 ,6,7}. Also, if there is a snake then it will take you to the bottom of it. So, in our board if I’m at node 6 then I can go to node {7,8,9,29,30, 1...