Изменил(а) на 'cv2/program.c'
This commit is contained in:
parent
2e11a7a179
commit
158a70911c
@ -15,15 +15,15 @@ int comparator (const void * p1, const void * p2){
|
|||||||
int* insertSort(int* array, int size){
|
int* insertSort(int* array, int size){
|
||||||
int temp;
|
int temp;
|
||||||
for(int i = 1; i < size; i++){
|
for(int i = 1; i < size; i++){
|
||||||
if(array[i] < array[i-1]){
|
if(array[i].price < array[i-1].price){
|
||||||
for(int j = i-1; j >= 0; j--){
|
for(int j = i-1; j >= 0; j--){
|
||||||
if(array[i] >= array[j]){
|
if(array[i].price >= array[j].price){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
temp = array[j];
|
temp = array[j].price;
|
||||||
array[j] = array[i];
|
array[j].price = array[i].price;
|
||||||
array[i] = temp;
|
array[i].price = temp;
|
||||||
i = j;
|
i = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user