Posts

Showing posts from October, 2014

Inbox From Google: Review

Image
In an another attempt to reorganise the way email communications work Google has come out with Inbox . Here, google has attempted to use machine learning and nlp for better organise email with a more intuitive UX. I believe this time they have utilised there learnings from Wave failure and have not attempted to change the core email component. But as people are slowly getting use to the timeline kind of UX, they have attempted to preserve that in email and top it up with the new features which they have always wanted to try but restricted by the plain UX of email, like "See pull request", "See flight status." Moreover, seems like this being designed specifically for phone devices. Lets see how useful this cool thing becomes. Never the less, please request an invite by sending a mail to inbox@google.com. I have requested mine and write a review as soon as I get an invite . I got an invite and have started using Inbox. I did not find it majorly innovati

Flatten a Binary Search Tree into a LinkedList in Java

package com.biplav.algorithms; public class FlattenBST { public static class TreeNode { public TreeNode left; public TreeNode right; public int value; public TreeNode(TreeNode left, TreeNode right, int value) { super(); this.left = left; this.right = right; this.value = value; } } public static class ListNode { public ListNode next; public int value; public ListNode(ListNode next, int value) { super(); this.next = next; this.value = value; } } public static ListNode flatten(TreeNode root) { ListNode left = root.left != null ? flatten(root.left) : null; ListNode base = new ListNode(null,root.value); ListNode right = root.right != null ? flatten(root.right) : null; base.next = right != null ? right : null; if(left == null) return base; else { ListNode home = left; while(left.next != null) left = left.next; left.next= base; return home; } } /* * 6 * 3 8 * 2 4 7 10 */

Alogrithm to sort a huge list of numbers in O(n) complexity in Java

A large file of numbers can be sorted in O(n) complexity by using a large bit array of the size same as the largest number in the list of numbers to be sorted. It can be done in Java using BitSet. package com.biplav.algorithms; import java.util.Arrays; import com.biplav.ds.BitArray; public class SortMillionNumbersWithGivenMax { //n+m public static int[] sort(int[] list, int max) { int[] sortedList = new int[list.length]; //BitSet bitSet = new BitSet(max); BitArray bitSet = new BitArray(max); for(int n:list) bitSet.set(n); //n int index=0; for(int i =0 ; i<=  max; i++) { //m if(bitSet.get(i)) { sortedList[index++] = i; } } return sortedList; } public static void main(String[] args) { int[] list = new int[]{1,2,3,4,5,9,15,18,25,7,11}; System.out.println(Arrays.toString(sort(list, 27))); } } I have used BitArray defined by me. Its implementation is: package com.biplav.ds; public class BitArray { private by

Fibonacci Series With Matrix Multiplication in Java with recursion.

Attempting to solve the fibonacci series using matrix multiplication applying divide and conquer to reduce the complexity to O(logN) package com.biplav.algorithms; public class FibonacciSeries { //2*2 matrix static int [][] multiply( int [][] X , int [][] Y ) { int [][] response = new int [2][2]; response [0][0] = X [0][0]* Y [0][0] + X [0][1]* Y [1][0]; response [0][1] = X [0][0]* Y [0][1] + X [0][1]* Y [1][1]; response [1][0] = X [1][0]* Y [0][0] + X [1][1]* Y [1][0]; response [1][1] = X [1][0]* Y [0][1] + X [1][1]* Y [1][1]; return response ; } static int [][] power( int [][] X , int N ) { if ( N == 1) { return X ; } else { int [][] X2 = power( X , N /2); return multiply( X2 , X2 ); } } public static int get( int n ) { int [][] X = new int [][] {{1,1},{1,0}}; return power( X , n )[0][0]; } public static void main(String[] args ) { System. out .println(get(4)); } }

Attendance.gov.in is First Modern looking site by Indian Government

Image
The http://attendance.gov.in/ is by far one of the first modern looking website by Indian Government. It uses bootstrap and Free bootstrap 2 theme sb-admin  http://startbootstrap.com/template-overviews/sb-admin/ Impressed by this sudden technology choices shift in the Indian Government websites, I decided to deep dive more on there technology stack and it was good to see there choices are improving. See the builtwith result here:  http://builtwith.com/attendance.gov.in Suprising there is no hint of the organisation created the site. But, I am happy to see the first mobile ready website of Indian Govt! :)

Flipkart Apology Email for bloopers on The Big Billion Day Sale.

Image
Here is the email which flipkart sent today apologising for bloopers on The Big Billion Day Sale. Apologies, from Flipkart regarding The Big Billion Day Unsubscribe Dear Customer,  Yesterday was a big day for us. And we really wanted it to be a great day for you. But at the end of the day, we know that your experience was less than pleasant. We did not live up to the promises we made and for that we are really and truly sorry.  It took enormous effort from everyone at Flipkart, many months of preparation and pushing our capabilities and systems to the limit to be able to create this day. We were looking at fulfilling the dreams of millions of Indian consumers through deals and offers we had painstakingly put together for months.  And though we saw unprecedented interest in our products and traffic like never before, we also realized that we were not adequately prepared for the sheer scale of the event. We didn't source enough products and deals in advance to ca