我们有一个未排序的数组,需要打印每个元素的位置,假设它被排序.
例如:我们有一个数组.
arr[] = {3, 2, 6, 1, 4}
//index: 1 2 3 4 5 Index of elements 1-based
//Sorted {1, 2, 3, 4, 6} List after sorting
//index: 4 2 1 5 3 Index of elements from original array
Run Code Online (Sandbox Code Playgroud)
它应该打印
4 2 1 5 3