【发布时间】:2018-10-09 09:09:26
【问题描述】:
按降序对数组进行排序,但方法是预定义的,我们只能调用它。我们不能修改它。它在该特定索引处以相反的顺序反转值。 我们通过传递一个数组和索引值来调用这个方法,比如 int funSort(int array[], int indexValue) ,它会返回一个反向的数组值,使用这个方法我们通过一次又一次地调用这个数组来排序这个数组降序。
例如:-
int method1(int array[],int indexValue){ .... }
int []array=new int[]{1,34,12,32,45,6,67};
//their indexed value 0 1 2 3 4 5 6
// Now we call it
method1(array,2);
//it return [12,34,1,32,45,6,67]
//like we again call it
method1(int AboveArray[],int randomIndex(3));
//it return [32,1,34,12,45,6,67]
// in final array descending arder array[67,45,34,32,12,6,1]
【问题讨论】:
-
您正在查看哪种语言?
-
我想要这个Java或C语言的解决方案,请尽快解决......
标签: arrays sorting data-structures linked-list