How do I count repeated words?
问题 Given a 1GB(very large) file containing words (some repeated), we need to read the file and output how many times each word is repeated. Please let me know if my solution is high performant or not. (For simplicity lets assume we have already captured the words in an arraylist<string> ) I think the big O(n) is "n". Am I correct?? public static void main(String[] args) { ArrayList al = new ArrayList(); al.add("math1"); al.add("raj1"); al.add("raj2"); al.add("math"); al.add("rj2"); al.add("math"