2D Array values frequency

Posted by Morano88 on Stack Overflow See other posts from Stack Overflow or by Morano88
Published on 2010-05-15T14:27:42Z Indexed on 2010/05/15 14:34 UTC
Read the original article Hit count: 300

Filed under:
|
|

If I have a 2D array that is arranged as follows :

  String X[][] = new String [][] {{"127.0.0.9", "60", "75000","UDP", "Good"},
                              {"127.0.0.8", "75", "75000","TCP", "Bad"},
                      {"127.0.0.9", "75", "70000","UDP", "Good"},
                      {"127.0.0.1", "", "70000","UDP", "Good"},
                      {"127.0.0.1", "75", "75000","TCP", "Bad"}
                                   };

I want to know the frequency of each value .. so I27.0.0.9 gets 2. How can I do a general solution for this ? In Java or any algorithm for any language ?

© Stack Overflow or respective owner

Related posts about java

Related posts about algorithm