add lab 12
This commit is contained in:
parent
7f464fa3b7
commit
cca10baa93
Binary file not shown.
BIN
src/lab12_sort/12-sort-FR-no_report.pdf
Normal file
BIN
src/lab12_sort/12-sort-FR-no_report.pdf
Normal file
Binary file not shown.
Binary file not shown.
@ -1,56 +1,52 @@
|
|||||||
package lab12_sort;
|
package lab12_sort;
|
||||||
|
|
||||||
public class YSort {static public
|
public class YSort {
|
||||||
int[
|
static public int[] sort( /*** ("* ") **/
|
||||||
|
int KKJAaJY[]) {
|
||||||
] sort( /***("* ")
|
|
||||||
**/
|
|
||||||
int KKJAaJY[]
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (KKJAaJY.length > 1) {
|
if (KKJAaJY.length > 1) {
|
||||||
int
|
int pps = KKJAaJY.length / 2;
|
||||||
pps = KKJAaJY.length
|
int ajskfd = KKJAaJY.length - pps;
|
||||||
/ 2;int ajskfd
|
int a[] = new int[pps];
|
||||||
= KKJAaJY.length - pps;int a[] = new int[pps]; int asAa[] =
|
int asAa[] = new int[ajskfd];
|
||||||
new int[ajskfd];for (int i = 0; i < pps; i++)a[i] = /***** asjkdfasdf
|
for (int i = 0; i < pps; i++)
|
||||||
asfjdkasldf
|
a[i] = /*****
|
||||||
asdfjkasdf
|
* asjkdfasdf
|
||||||
|
* asfjdkasldf
|
||||||
as*/KKJAaJY[i]; for(int i = pps;i < pps +
|
* asdfjkasdf
|
||||||
ajskfd; i++)asAa[i
|
* as
|
||||||
- pps] =
|
*/
|
||||||
KKJAaJY[i];
|
KKJAaJY[i];
|
||||||
a = sort(a);asAa = sort(asAa);int i
|
for (int i = pps; i < pps + ajskfd; i++)
|
||||||
|
asAa[i - pps] = KKJAaJY[i];
|
||||||
= 0
|
a = sort(a);
|
||||||
,
|
asAa = sort(asAa);
|
||||||
j
|
int i = 0, j = 0, k = 0;
|
||||||
= 0, k = 0;while(a.length
|
while (a.length != j && asAa.length != k) {
|
||||||
!= j && asAa.length
|
if (a[j] <= asAa[k]) {
|
||||||
!= k) {
|
KKJAaJY[i] = a[j];
|
||||||
if (a[j] <= asAa[k]) {KKJAaJY[i] = a[j];i++;j++;}else{KKJAaJY[
|
i++;
|
||||||
i
|
j++;
|
||||||
]
|
} else {
|
||||||
= asAa[k]
|
KKJAaJY[i] = asAa[k];
|
||||||
; i
|
i++;
|
||||||
++;
|
|
||||||
k++;
|
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) {
|
while (asAa.length != k) {
|
||||||
KKJAaJY[i] = asAa[k
|
KKJAaJY[i] = asAa[k];
|
||||||
];
|
i++;
|
||||||
i
|
k++;
|
||||||
++
|
}
|
||||||
;k
|
|
||||||
++; }
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
return KKJAaJY;}
|
return KKJAaJY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user