hi,
how does the comparator function will work if I pass numbers as strings.
eg I pass “30”,“3”,“34”,“9”
and when I am arranging them in descending order
output is 9 34 30 9
thanks
Comparator doubt
It get sorted lexiographically in descending order
I am not able to get it.
pls explain
thanks
pls explain again,thanks
lexiographical order means that when u find a word in dictionary then the words are sorted according to the order of occurrences in dictionary. If u find the above strings in the dictionary then the order of their appearances is 3 30 34 9.
comparison is done as 3 and 30.
or it is being done as three and thirty.ie. spelling wise.
thanks
Between 3 and 30. Not spelling wise
can we say ASCII value is being compared?
Yes you can compare by considering that.