Deep Inside Learning

I work as Android Developer. Currently learning the Machine Learning, Data Science and Life too. This is my personal blog and any views expressed here are mine, and not my employers.

Page 5


Floyd-Warshall Algorithm

If you want to find the length of node and shorthest path in a graph we can use Floyd-Warshall Algorithm

`
int [][] map = new int[n][n];
for (int i = 0; i < n; i++) {
Arrays.fill(map[i], Integer.MAX_VALUE/2);
}
for (int i = 0; i < n; i++) {
map[i][i] = 0;
}
for (int i = 0; i < a.length; i++) {
map[a[i]-1][b[i]-1] = len[i];
map[b[i]-1][a[i]-1] = len[i];
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
for (int j2 = 0; j2 < n; j2++) {
map[j][j2] = Math.min(map[j][j2], map[j][i] + map[i][j2]);
}
}

    }

`

You can see the explanation in here : http://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm

View →


SRM 629 Div 2 1000 Points

If you are following the topcoder SRM 629 div 2 this is the source code

public class CandyAddict {

public static void main(String[] args) {
    solve(new int[]{1000000000,1000000000,1000000000,1000000000,1000000000},
            new int[]{1,2,3,999999998,999999999},
    new int[]{342568368,560496730,586947396,386937583,609483745});

}

public static  long [] solve(int[] X, int[] Y, int[] Z){
    int qLength = X.length;
    long [] result = new long[qLength]; 
    for (int i = 0; i < qLength; i++) {
        long money = 0;
        long candy = 0;
        for (int j = 0; j < Z[i]; j++) {
            money += X[i];
            if (candy <= 0){
                candy = money / Y[i];
                money = money % Y[i];
            }
            if (candy > 0){
                candy -=1;
            }
        }
        result[i] = money;
        System.out.println(money);

    }

    return
...

Continue reading →


Top Coder SRM 628 Div 2 - 500 Point

If you are participate in Top Coder SRM 628 Div 2, this is solution for 500 point

import java.util.ArrayList;

public class BracketExpressions {

public static String ifPossible(String expression){
    Character [] pattern1 = new Character[]{'{','}'};
    Character [] pattern2 = new Character[]{'(',')'};
    Character [] pattern3 = new Character[]{'[',']'};
    char[] y = expression.toCharArray();
    ArrayList<Character> data = new ArrayList<Character>();
    for (int i = 0; i < y.length; i++) {
        System.out.println("processing " + ((data.size()>0)?data.get(0).toString():-1) + " and " + y[i] );
        if (data.size() > 0 && data.get(0) != 'X' && y[i] == 'X'){
            System.out.println("Pop " + data.get(0) + " because meet X");
            data.remove(0);
        }
        else if (y[i] == pattern1[0] || y[i] == pattern2[0]|| y[i] == pattern3[0] || y[i] == 'X' )
        {
...

Continue reading →


Releasing Jaha Manga

3 months ago i have an idea to create an mobile apps to read manga from mobile phone. This is the screenshot for the first app Screenshot_2014-08-01-13-54-12.png

But unfortunately google reject my apps. I think it cause by the name “Manga Reader” and last week i’m continuing to change the package name of our app and after working for it this is the new release of the apps with new design

1.png

And finally i revamped the logo to the new branding logo OCT (1).png

You can get it from the playstore now for Free!

https://play.google.com/store/apps/details?id=com.antares.jahamanga

Continue reading →


Working for kawalpemilu for android

On 9 July, Indonesia is doing the biggest democracy event for Indonesian poeple - The Election of Indonesian Presiden (Pemilu in Indonesian). The euforia is so big. Social media is so crowded about news from candidate no 1 Prabowo Subianto - Hatta Rajasa and Joko Widodo - Jusuf Kalla.

As part of this to guard the election Ainun Najib (https://twitter.com/ainunnajib) an ERP Consultant in IBM singapore make a web www.kawalpemilu.org. A lot of attention to this about afraid of cheating make the traffice of the website so high. And as part of that i built the Android version of kawalpemilu.org. The source code is available at https://www.github.com/linggom/kawalpemiluandroid

And how it works ? simple. First i review the source code of www.kawalpemilu.org and look that the website is using kawal-pemilu.appspot.com (Google App Engine) as their host for the API. And start exploring the...

Continue reading →