Character count program in java
This program will also count spaces I we will give it. You must be logged in to post a comment. Page Contents 1 How this Java program will behave?
Recommended Articles. Article Contributed By :. Easy Normal Medium Hard Expert. Writing code in comment? Please use ide. Load Comments. What's New. Not to mention all the work needed to maintain that HashMap. I'm accepting your challenge and testing this out.
I think you could add is there a reason to go with the fastest way - do you believe that other methods would cause bottlenecks? How much faster would it really be? If the speed was acquired by some monstrously complex hacks, that would be another thing. Show 7 more comments. Tala Tala 8, 5 5 gold badges 31 31 silver badges 36 36 bronze badges.
Add a comment. Adam Stelmaszczyk Adam Stelmaszczyk Please let me know if you need help with this or if you can figure it out with this information : EDIT: once you have filled the TreeSet with all of the letters, all you have to do is start getting them out 1 by 1 until the occcurence of the one that you took out is less than the one you took before ie, if the top 3 letters appeared 3 times and the forth one 2, you only display the first 3.
Jose Sutilo Jose Sutilo 1 1 gold badge 5 5 silver badges 7 7 bronze badges. Paniz Paniz 5 5 silver badges 18 18 bronze badges. HashMap or ArrayList? See Marko answer, that do this. Ilesh Patel Ilesh Patel 45 5 5 bronze badges. Rollyng Rollyng 1, 2 2 gold badges 11 11 silver badges 18 18 bronze badges. Have you thought about cost of that algorithm? You need to that for each letter from the alphabet. I just give two solutions, in the first one, there is no need to search in the whole alphabet.
Usually we downvote bad solutions, here is not the case, you might suggest above solutions to be aware of memory issues. But thanks for your concerns — Rollyng. Sign up or log in Sign up using Google. Python Design Patterns. Python Pillow. Python Turtle. Verbal Ability. Interview Questions. Company Questions. Artificial Intelligence. Cloud Computing. Data Science.
0コメント