Hi Friends

Hash Map takes 2byte [in Java] for holding a character

So in Amazon -
It takes A - 1
M - 1
Z - 1
O - 1
N - 1

But it's time effective!

Yes it takes additional space for intergers, for each key 4 byte for an
integer!!! :-(



    ***********

 public void checkTheFrequency() {
        for (int i = 0; i < str.length(); i++) {
            char key = str.charAt(i);

            if (checkMap.containsKey(key)!=
false) {
                int value = checkMap.get(key);
                checkMap.put(key, ++value);
            } else {
                checkMap.put(key, 1);
            }
        }

*****************
Best Regards
Kaushik

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to