add lab 12

This commit is contained in:
Rémi Heredero 2022-03-08 09:37:05 +01:00
parent 7f464fa3b7
commit cca10baa93
4 changed files with 43 additions and 47 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,56 +1,52 @@
package lab12_sort;
public class YSort {static public
int[
] sort( /***("* ")
**/
int KKJAaJY[]
)
{
public class YSort {
static public int[] sort( /*** ("* ") **/
int KKJAaJY[]) {
if (KKJAaJY.length > 1) {
int
pps = KKJAaJY.length
/ 2;int ajskfd
= KKJAaJY.length - pps;int a[] = new int[pps]; int asAa[] =
new int[ajskfd];for (int i = 0; i < pps; i++)a[i] = /***** asjkdfasdf
asfjdkasldf
asdfjkasdf
as*/KKJAaJY[i]; for(int i = pps;i < pps +
ajskfd; i++)asAa[i
- pps] =
KKJAaJY[i];
a = sort(a);asAa = sort(asAa);int i
= 0
,
j
= 0, k = 0;while(a.length
!= j && asAa.length
!= k) {
if (a[j] <= asAa[k]) {KKJAaJY[i] = a[j];i++;j++;}else{KKJAaJY[
i
]
= asAa[k]
; i
++;
int pps = KKJAaJY.length / 2;
int ajskfd = KKJAaJY.length - pps;
int a[] = new int[pps];
int asAa[] = new int[ajskfd];
for (int i = 0; i < pps; i++)
a[i] = /*****
* asjkdfasdf
* asfjdkasldf
* asdfjkasdf
* as
*/
KKJAaJY[i];
for (int i = pps; i < pps + ajskfd; i++)
asAa[i - pps] = KKJAaJY[i];
a = sort(a);
asAa = sort(asAa);
int i = 0, j = 0, k = 0;
while (a.length != j && asAa.length != k) {
if (a[j] <= asAa[k]) {
KKJAaJY[i] = a[j];
i++;
j++;
} else {
KKJAaJY[i] = asAa[k];
i++;
k++;
}
}while (a.length != j) { KKJAaJY[i] = a[j]; i++;
j++;
// }
}
//
//
while (a.length != j) {
KKJAaJY[i] = a[j];
i++;
j++;
// }
}
//
//
while (asAa.length != k) {
KKJAaJY[i] = asAa[k
];
i
++
;k
++; }
KKJAaJY[i] = asAa[k];
i++;
k++;
}
}
//
return KKJAaJY;}
return KKJAaJY;
}
}