+ 9

Compare strings in lexicographic order?(Java or algorithm)

Does anyone know how to compare a range of words and organize them in lexicographic order? but can't use String.compareTo or Collator.

20th Nov 2017, 3:36 AM
Malkon F
Malkon F - avatar
6 Respostas
+ 7
i correct, i hope that now is OK 😃
20th Nov 2017, 10:20 PM
Vukan
Vukan - avatar
+ 4
perfect! only changes the signal from > to < in the if inside of the for. The word Java comes first in lexicographic order.
20th Nov 2017, 10:09 PM
Malkon F
Malkon F - avatar
+ 4
for some inputs it does not work, but your code helped me to think better about the problem. leao ana...leao comes first in your code
20th Nov 2017, 10:17 PM
Malkon F
Malkon F - avatar
+ 2
hey, I have modified the code, now it seems to be working correctly for all inputs. Take a look and tell me pls https://code.sololearn.com/c52YeSNtNkaJ/?ref=app
21st Nov 2017, 8:25 PM
Malkon F
Malkon F - avatar
+ 2
I think now it is only necessary to allow the user to enter several words, store the words in arrays and send the aarray to the method classifies the words.
21st Nov 2017, 8:45 PM
Malkon F
Malkon F - avatar