Suppose I have 3 arrays.
arr1 = {96, 100, 104, 108}
arr2 = {8, 4, 4, 16}
Now I create a third array in which I will store elements = arr1[i]/arr2[i]
Therefore arr3 = {12, 25, 26, 9}
Now I want to sort arr3
. But also sort arr1
and arr2
in the same order.
Like now arr3 = {9, 12, 25, 26}
I also want to sort arr1
and arr2
by the same order meaning
arr1 = {108, 96, 100, 104} arr2 = {16, 8, 4, 4}
So for arr3[2] = 26
I can print/use arr1[2] = 96 && arr2[2] = 8
.
I want to be able to access the element of arr1
and arr2
by arr3
.