Suppose the user enters an array, for example:
Array = {France, Spain, France, France, Italy, Spain, Spain, Italy}
which I knew about its length
array index :
index = {0, 1, 2, 3, 4, 5, 6, 7}
Now, after sorting using Arrays.sort(Array);
newArray will look like this:
newArray = {France, France, France, Italy, Italy, Spain, Spain, Spain}
and newIndex will be:
newIndex = {0, 2, 3, 4, 7, 1, 5, 6}
The problem is this: how can I find newIndex from the input array?
Thank you in advance
java
Eng.Fouad Feb 01 2018-11-11T00: 00Z
source share