I read the text and calculate how many times this value has occurred in the text. For this, I use ArrayList when adding more than one character of the same type that is already in my ArrayList .... I am incrementing the counter. Therefore, at the end of the method, I can print the letters of the alphabet contained in the text corresponding to the corresponding occurrence.
for(int i; i < text.length i++)
counter = 0
if arraylist already contains the character then continue
otherwise add the character to the array
for j; j < text.length j++
if index of text(j) and text(i) == the same
counter++
system out print arraylist[i] + counter
This is pseudo code, to give you an idea of how my program works, I do not want to publish the actual code as it is being evaluated, and I acknowledge that people use it.
So, I'm looking for a way to determine how to find the highest and lowest letters that have occurred. I fight for ideas if I don’t pass both the counter and the index index character of the array list into some kind of data structure such as hashmap = / I feel like I really have to overdo it, though, unless I structured my program not the best for what I'm trying to do. Because, obviously, I can’t compare the counts of each cycle? .... the question is whether hashmap can be better and it is worth restarting everything.
In any case, any suggestions are welcome! (this is being evaluated, so please do not give an answer, but more options for how you can approach it)
source
share