Suppose a fair coin is tossed repeatedly until the same outcome occurs twice in a row

http://mathforum.org/library/drmath/view/65495.html

http://www.qbyte.org/puzzles/p082s.html

Advertisements

backend options

http://www.raywenderlich.com/20482/how-to-choose-the-best-backend-provider-for-your-ios-app-parse-vs-stackmob-vs-appcelerator-cloud-and-more

http://www.raywenderlich.com/19341/how-to-easily-create-a-web-backend-for-your-apps-with-parse

https://github.com/dornad/TutorialBase

http://www.raywenderlich.com/44640/integrating-facebook-and-parse-tutorial-part-1

http://www.raywenderlich.com/44833/integrating-facebook-and-parse-tutorial-part-2

intern statement

I would love to join a team of people building a product that I’m passionate about. The internship will provide invaluable production experience while still being a student. I get to work with an amazing group of Network Service developers, and learn ideas and concepts that can be used in future projects.

InversionCount

http://stackoverflow.com/questions/337664/counting-inversions-in-an-array

public static int merge(int[] a, int p, int q, int r)
{
    //p=0, q=1, r=3
    int countingInversion = 0;
    int n1 = q-p+1;
    int n2 = r-q;
    int[] temp1 = new int[n1+1];
    int[] temp2 = new int[n2+1];
    for(int i=0; i<n1; i++) temp1[i] = a[p+i];
    for(int i=0; i<n2; i++) temp2[i] = a[q+1+i];

    temp1[n1] = Integer.MAX_VALUE;
    temp2[n2] = Integer.MAX_VALUE;
    int i = 0, j = 0;

    for(int k=p; k<=r; k++)
    {
        if(temp1[i] <= temp2[j])
        {
            a[k] = temp1[i];
            i++;
        }
        else
        {
            a[k] = temp2[j];
            j++;
            countingInversion=countingInversion+(n1-i); 
        }
    }
    return countingInversion;
}
public static void main(String[] args)
{
    int[] a = {1, 20, 6, 4, 5};
    int countInversion = mergeSort(a, 0, a.length-1);
    System.out.println(countInversion);
}