mirror of
https://github.com/tu-darmstadt-informatik/AuD18.git
synced 2025-12-13 01:45:49 +00:00
Add QuickSort skeleton project
This commit is contained in:
parent
4de00c2fd5
commit
43688b2237
7
QuickSort/.classpath
Executable file
7
QuickSort/.classpath
Executable file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
QuickSort/.project
Executable file
17
QuickSort/.project
Executable file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>QuickSort</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
200
QuickSort/TestFile1_r_200
Executable file
200
QuickSort/TestFile1_r_200
Executable file
@ -0,0 +1,200 @@
|
||||
E465L;ZPOE;OK
|
||||
1L1L4;UX8H;Error
|
||||
8RPUZ;XCTV;OK
|
||||
JZXHZ;FCB6;Error
|
||||
FMF1Q;TZ0Q;Error
|
||||
KC83O;JVA8;Error
|
||||
NXM6F;6UWJ;Error
|
||||
3JJG5;VRZE;OK
|
||||
VM22T;8ESM;Error
|
||||
L2Z74;99YH;Error
|
||||
DP56R;7OTD;OK
|
||||
Q7ZTQ;89QL;OK
|
||||
86KFC;JR4C;Error
|
||||
VXNZ7;8ZUK;OK
|
||||
U36TU;Q5NO;Error
|
||||
F719A;EV11;Error
|
||||
EU67U;U9A3;OK
|
||||
LG932;LEB6;Error
|
||||
0P5HI;2DMR;OK
|
||||
0NCJZ;D3CV;OK
|
||||
1STNG;9LVC;OK
|
||||
DRRJ7;Q5NO;OK
|
||||
SAVV1;5KY4;Error
|
||||
0KQVF;A2B2;OK
|
||||
9CU9S;2DMR;Error
|
||||
PAV4X;FJM7;OK
|
||||
K38C6;FVNX;Error
|
||||
ZOFOB;XX3N;Error
|
||||
BSN3X;8AHW;OK
|
||||
14ST0;1GLP;OK
|
||||
XBL3V;EGBN;OK
|
||||
0RC82;WVH9;OK
|
||||
CLXEN;80QC;Error
|
||||
JQ83G;L5WJ;OK
|
||||
BXYWG;YXB1;OK
|
||||
CO5LB;99YH;OK
|
||||
K927G;RGU0;OK
|
||||
NEWII;80QC;OK
|
||||
NOKXR;2PRB;OK
|
||||
O1RX0;9LVC;OK
|
||||
9GRZ6;ZPOE;OK
|
||||
3W314;H2J2;OK
|
||||
GFV8X;4TT0;Error
|
||||
EDG34;09VY;OK
|
||||
9OZGG;CD24;Error
|
||||
FMO3R;6UWJ;Error
|
||||
9OZGG;SF97;OK
|
||||
8ENSQ;EGV9;OK
|
||||
YMUEM;9LVC;Error
|
||||
IUS3K;395W;OK
|
||||
5IWA9;IAT7;OK
|
||||
FJCWM;XH85;Error
|
||||
HS8YT;7V0S;OK
|
||||
4OVZB;RS9F;OK
|
||||
9BTCH;8AHW;Error
|
||||
VUVLP;Y15Z;Error
|
||||
SYXNL;6YLW;Error
|
||||
OQZMH;U9A3;OK
|
||||
G0BSD;EV11;OK
|
||||
UXF2K;6GIK;OK
|
||||
7L3ML;7A9L;OK
|
||||
HRR27;B6JY;Error
|
||||
REHE6;W3BW;Error
|
||||
VRDJ7;ATFM;OK
|
||||
E7A1M;44EK;OK
|
||||
BGVDD;DD7Y;OK
|
||||
C5YJW;D6D6;OK
|
||||
77OJY;WVH9;OK
|
||||
QRAUS;EV11;Error
|
||||
H7QMX;ATFM;Error
|
||||
ZOMQF;YH0E;OK
|
||||
319BC;WVH9;OK
|
||||
9CX82;C34A;OK
|
||||
XHWDP;TP5Y;OK
|
||||
E95U6;FVNX;Error
|
||||
TY4L8;P0D3;OK
|
||||
F719A;XCTV;OK
|
||||
1JA7N;25C0;Error
|
||||
LVHB1;T5OJ;OK
|
||||
OHPOU;KMF6;Error
|
||||
JRW9L;7A9L;Error
|
||||
VME7Y;JFE8;OK
|
||||
5IWA9;8ZUK;OK
|
||||
BGE1D;4MXI;OK
|
||||
YQHNJ;0KX3;OK
|
||||
A7QI4;YXB1;OK
|
||||
H6H1P;YTB6;OK
|
||||
DFTPB;ZPOE;Error
|
||||
CQZ7H;IAT7;OK
|
||||
LHVNE;VRZE;Error
|
||||
GFITE;ZJ32;OK
|
||||
P16DM;YJJ2;Error
|
||||
CWBC4;Y894;Error
|
||||
WS23I;WVH9;OK
|
||||
BQSM1;3P9C;OK
|
||||
DYBGI;S0SQ;Error
|
||||
2LX2P;KT7P;Error
|
||||
8RPUZ;395W;Error
|
||||
ZSIF7;4Y5Z;Error
|
||||
SGI9T;5KY4;Error
|
||||
3DOZW;3ASN;Error
|
||||
DVOMX;JAQR;OK
|
||||
CLFZW;9NLE;OK
|
||||
I7PV7;D6D6;Error
|
||||
8P8MH;TZ0Q;Error
|
||||
RQPFF;YH0E;Error
|
||||
Q5IUI;859T;OK
|
||||
UJ2HT;D6D6;OK
|
||||
3FFRR;DN7A;OK
|
||||
MKO7P;KT7P;OK
|
||||
ZZ10T;OHGC;OK
|
||||
TKGOS;DDHF;OK
|
||||
M4306;5GGN;Error
|
||||
ESVJM;RJND;Error
|
||||
WS23I;RGU0;Error
|
||||
W0KBB;1RE7;Error
|
||||
9WO9L;P0D3;Error
|
||||
6O38S;Q50L;OK
|
||||
BMLKQ;YTB6;Error
|
||||
2YLSD;9LVC;OK
|
||||
LKEH0;L2PF;OK
|
||||
XTIHK;TP5Y;Error
|
||||
3PY3A;WVH9;Error
|
||||
3UI43;37J5;OK
|
||||
YQHNJ;LR7M;Error
|
||||
OTYAH;43JX;Error
|
||||
BFC57;0I1Y;Error
|
||||
UJ2HT;EEDR;OK
|
||||
8B7N3;OJT3;OK
|
||||
6KMH1;4Y5Z;OK
|
||||
I38QI;GSPH;OK
|
||||
94IJ3;LE63;OK
|
||||
E9NT6;L5WJ;Error
|
||||
YC7T3;09VY;OK
|
||||
QXBAY;Q2L2;OK
|
||||
G5FWT;XCTV;OK
|
||||
94IJ3;LEB6;Error
|
||||
SSG24;YXB1;Error
|
||||
268AS;2DMR;Error
|
||||
E465L;F9NB;Error
|
||||
UXF2K;KT7P;OK
|
||||
CF16I;4TT0;OK
|
||||
W1D9U;I014;OK
|
||||
HHOVE;395W;Error
|
||||
1JA7N;8ESM;OK
|
||||
OMH2W;X3M0;OK
|
||||
3XFEY;5GGN;Error
|
||||
BUW0P;KT7P;OK
|
||||
O4SPF;GSPH;OK
|
||||
A9YFG;CZON;OK
|
||||
7NMOR;3ID1;Error
|
||||
USDYV;1RE7;OK
|
||||
7UAEP;6D24;Error
|
||||
6XVNR;P0D3;OK
|
||||
UM6PE;LJ7N;Error
|
||||
FVLCW;RMHO;OK
|
||||
YLHFB;R8UM;OK
|
||||
743OD;MY1V;OK
|
||||
AUC77;RGU0;Error
|
||||
Q49RP;DN7A;OK
|
||||
NH4W8;1RE7;Error
|
||||
KB7Q0;18FN;Error
|
||||
6CQWQ;JDDK;OK
|
||||
ZUU35;DDHF;Error
|
||||
PIRKE;7A9L;OK
|
||||
UPTGF;45PZ;OK
|
||||
M4PKR;VRZE;OK
|
||||
0JUH1;WVH9;Error
|
||||
WU7BL;KPAC;OK
|
||||
T4OJG;O4WO;OK
|
||||
YNIN7;VWE3;OK
|
||||
DJTA5;H2J2;OK
|
||||
KR3V0;X4Q1;Error
|
||||
DWIK3;KMF6;Error
|
||||
ZXMUT;RM6U;Error
|
||||
SFV4O;CTDU;OK
|
||||
ZE5XG;0KX3;Error
|
||||
MMHH2;LE63;Error
|
||||
8PWH0;RM6U;OK
|
||||
26P62;10KK;OK
|
||||
S16LO;8ZUK;OK
|
||||
7GBHX;T5OJ;Error
|
||||
DVFJ8;SW7O;OK
|
||||
BBXGH;21W7;Error
|
||||
B2QM1;OHGC;Error
|
||||
OA825;7A9L;Error
|
||||
61AK8;99YH;OK
|
||||
TC61Z;Q4MB;OK
|
||||
TZ3WA;6D24;OK
|
||||
2LIZC;IUS0;Error
|
||||
IB757;TP5Y;Error
|
||||
CLFZW;MOM3;OK
|
||||
CGIT9;A2B2;OK
|
||||
4H6NB;7OTD;OK
|
||||
PCAGI;5GGN;OK
|
||||
L5NTH;RJND;OK
|
||||
9JELP;37J5;OK
|
||||
EZPWS;CTDU;OK
|
||||
QGH3K;43JX;Error
|
||||
LEYIS;8AHW;Error
|
||||
200
QuickSort/TestFile2_a_200
Executable file
200
QuickSort/TestFile2_a_200
Executable file
@ -0,0 +1,200 @@
|
||||
0GBP3;86AY;OK
|
||||
0GBP3;IKXE;OK
|
||||
0GW45;P2N9;Error
|
||||
0H6SX;H0JJ;Error
|
||||
0L064;O8WM;OK
|
||||
0L064;R0BI;Error
|
||||
0L064;XSO7;Error
|
||||
0PJTO;VGA6;OK
|
||||
0YSKM;DPN4;Error
|
||||
115BB;WKSI;OK
|
||||
158A8;JFUE;OK
|
||||
158A8;KCTK;OK
|
||||
16RXS;ZM5F;Error
|
||||
1PEVQ;607G;Error
|
||||
1PHZC;78TV;OK
|
||||
2480H;KN8K;Error
|
||||
2BK6V;W6HR;Error
|
||||
2ISFI;OCSN;OK
|
||||
2QYYE;T4BM;Error
|
||||
2V6VD;HMID;OK
|
||||
2VN7R;MXRS;OK
|
||||
32684;T4BM;Error
|
||||
3581M;9NGF;Error
|
||||
3GRZ4;CXZV;Error
|
||||
3QAJU;E8NL;Error
|
||||
3UPMM;Z6NO;OK
|
||||
43MZ2;6WM8;Error
|
||||
448J1;CXQY;OK
|
||||
448J1;SIS8;OK
|
||||
5WZS6;6VQ6;Error
|
||||
5ZO9A;333M;Error
|
||||
622NT;F56J;OK
|
||||
624YF;YM29;OK
|
||||
68VMT;WKSI;OK
|
||||
6IW9W;T4BM;OK
|
||||
6SH7N;7JUA;Error
|
||||
6WVE6;H8JW;Error
|
||||
706JA;2WXD;OK
|
||||
74D28;KIRS;Error
|
||||
7FUNA;WKSI;OK
|
||||
7Q0TC;E8NL;OK
|
||||
7Q0TC;ZHO1;Error
|
||||
7WZDW;8ZRU;Error
|
||||
87MLJ;IA89;OK
|
||||
87VBJ;XP7N;Error
|
||||
8FM9E;WLKL;OK
|
||||
8K618;O8WM;Error
|
||||
8MF0K;HEO6;OK
|
||||
93R1Y;VGA6;Error
|
||||
979S5;KUMO;Error
|
||||
98QRU;JMKP;OK
|
||||
9FKI0;JFUE;Error
|
||||
9HMDJ;HMID;Error
|
||||
A46CS;5CAD;Error
|
||||
AE33P;6EYV;OK
|
||||
AE33P;8FFE;Error
|
||||
AVQ1T;IKXE;Error
|
||||
AYCAP;46XX;OK
|
||||
B30HO;867Q;Error
|
||||
B30HO;QUGA;Error
|
||||
BFJIO;B6BP;OK
|
||||
BHODM;QUGA;Error
|
||||
BS1GQ;CXQY;OK
|
||||
BTMJH;H0JJ;Error
|
||||
C2DOT;66SO;OK
|
||||
CA60V;XV31;OK
|
||||
D0BDA;F9CG;OK
|
||||
DAXXS;XSO7;Error
|
||||
DQGZE;IMWN;Error
|
||||
DSBXK;FLN4;OK
|
||||
E89EM;4XKA;OK
|
||||
EDBHN;89BA;OK
|
||||
EU2Z3;N2AT;Error
|
||||
F8RPY;Q10Z;OK
|
||||
FBJ9M;2WXD;OK
|
||||
FCWQI;WZWB;Error
|
||||
FJ4JQ;9MMM;Error
|
||||
FJ4JQ;XSO7;Error
|
||||
FLKIJ;1JL0;Error
|
||||
G2LWD;YUIF;OK
|
||||
G50I2;D05O;OK
|
||||
G5YES;Z4W7;OK
|
||||
GETRN;30EP;OK
|
||||
GHYZV;KCTK;OK
|
||||
GMCZF;LIDE;Error
|
||||
GRA1E;ETGA;Error
|
||||
GSDXS;CJ0G;Error
|
||||
GWF8H;YM29;Error
|
||||
H8OQT;HZTZ;OK
|
||||
HDLS4;FLN4;Error
|
||||
HJMUK;JTJS;Error
|
||||
HKJ4Z;OS6Z;OK
|
||||
HN5WE;A5P1;Error
|
||||
HPHF4;61U6;Error
|
||||
HSIK6;XP7N;OK
|
||||
I4O34;CJ0G;OK
|
||||
I9NRE;2WXD;Error
|
||||
ICCT0;CJ0G;Error
|
||||
IEH2K;2JMX;Error
|
||||
IV6NS;67X6;Error
|
||||
J2FHK;6IPE;OK
|
||||
J2RNK;G9E7;OK
|
||||
J7BT1;9UPZ;OK
|
||||
JAEOM;CXZV;Error
|
||||
JGJMZ;7JUA;Error
|
||||
JMBBU;67X6;Error
|
||||
JRWU2;5C3H;Error
|
||||
JTIKF;FT5L;Error
|
||||
K2B5N;9RHT;OK
|
||||
KDT7R;C1HD;Error
|
||||
KSMOX;HEBA;OK
|
||||
LI5TN;6WRG;OK
|
||||
M57DW;JFUE;OK
|
||||
MAGNO;931H;Error
|
||||
MGZ00;9UPZ;Error
|
||||
MGZ00;H8JW;OK
|
||||
MM1ZE;W6HR;Error
|
||||
NJZY4;WZGX;OK
|
||||
NNXXC;W5XD;OK
|
||||
O3SEP;B10O;OK
|
||||
O6LPS;A5P1;Error
|
||||
OBQLI;IA89;OK
|
||||
OBUQF;PUZ3;Error
|
||||
OPMJA;2IMJ;Error
|
||||
OPO09;4XKA;OK
|
||||
P0A51;C7HC;OK
|
||||
P0Y4G;XOS3;OK
|
||||
P6WIR;CXQY;OK
|
||||
PNUK7;HW49;Error
|
||||
PNUK7;OLPS;Error
|
||||
PPT4H;Y4IB;OK
|
||||
PXUVB;ZVKD;OK
|
||||
Q6PZO;C7HC;Error
|
||||
Q6PZO;FX4R;OK
|
||||
Q7RQX;9RHT;OK
|
||||
Q8SVP;OL0C;OK
|
||||
QASS0;46XX;Error
|
||||
QYHC7;89BA;OK
|
||||
QYHC7;Q10Z;OK
|
||||
QYISW;JMKP;Error
|
||||
R5LG4;1THF;Error
|
||||
R9G7S;2ENY;OK
|
||||
RC4IT;36S5;OK
|
||||
RCOAW;61U6;Error
|
||||
REN4L;H8JW;OK
|
||||
RJ4X0;CTX6;Error
|
||||
RPR1U;8JUJ;Error
|
||||
RUDFB;7K54;OK
|
||||
RZSGI;C1HD;Error
|
||||
SF6HV;320A;Error
|
||||
SHABI;2IMJ;Error
|
||||
SKE83;SWZK;Error
|
||||
SZHCN;Y4IB;OK
|
||||
T2HR0;86AY;OK
|
||||
T30ZM;4XKA;OK
|
||||
TA2ZX;78TV;OK
|
||||
TI5R3;IKXE;Error
|
||||
TOBKY;XM2T;Error
|
||||
TWPJ8;OT1T;Error
|
||||
TWYGA;477Z;OK
|
||||
U50BS;R86R;Error
|
||||
UD0NQ;XM2T;OK
|
||||
UFPVF;H0JJ;OK
|
||||
UKB3Z;O8WM;Error
|
||||
UN9GX;3D6Z;Error
|
||||
UU7BT;BIDX;OK
|
||||
UWPYB;W6HR;OK
|
||||
V0RWP;OS6Z;OK
|
||||
VF1XC;547O;Error
|
||||
VL0MR;YOV8;Error
|
||||
VNSLE;290Y;OK
|
||||
VPXT7;8FFE;Error
|
||||
VTLGW;OCGQ;OK
|
||||
W0YTD;HEBA;OK
|
||||
W208H;2IMJ;Error
|
||||
W7EWC;B10O;Error
|
||||
W9H9D;KN8K;OK
|
||||
W9O8U;4FHE;OK
|
||||
WP90I;28KA;Error
|
||||
WWO8T;WLKL;Error
|
||||
X51DD;HW49;Error
|
||||
XD4W2;B6BP;Error
|
||||
XKDG4;TT2A;Error
|
||||
XRIP2;O8WM;Error
|
||||
Y0NFF;30EP;Error
|
||||
Y206X;2W1J;Error
|
||||
Y3WZQ;H6KD;Error
|
||||
Y8SLN;6641;OK
|
||||
YJ05T;6D3Y;Error
|
||||
YMLBK;RUNT;OK
|
||||
YSKQ7;TIEF;OK
|
||||
YYJ1D;H0JJ;Error
|
||||
Z1TEX;78TV;Error
|
||||
ZDYG9;61U6;OK
|
||||
ZEZ6Z;78TV;Error
|
||||
ZFQS2;YF49;OK
|
||||
ZOW24;6IPE;OK
|
||||
ZP83Z;MXRS;OK
|
||||
ZREO5;I2MV;OK
|
||||
ZREO5;T4BM;Error
|
||||
200
QuickSort/TestFile3_d_200
Executable file
200
QuickSort/TestFile3_d_200
Executable file
@ -0,0 +1,200 @@
|
||||
ZO1DU;GDBX;Error
|
||||
ZM6P0;OXS5;Error
|
||||
ZJ295;MSF2;Error
|
||||
Z0LWK;V6Q8;Error
|
||||
YU5Z3;SCFY;OK
|
||||
YTXJ6;5IMY;OK
|
||||
YKYMG;2HLI;Error
|
||||
YGUXQ;3A2Q;OK
|
||||
YA5YS;LEDT;Error
|
||||
Y96AD;ZUVS;OK
|
||||
XYEE7;V05Q;Error
|
||||
XRTJ4;SZ51;OK
|
||||
XPJ1I;NUNP;Error
|
||||
XODKE;R0GS;Error
|
||||
XH100;SDGS;OK
|
||||
XFDA0;4MEA;Error
|
||||
XB7KM;BTR6;OK
|
||||
X6VO7;WUUF;OK
|
||||
X2Z08;LEDT;Error
|
||||
X0YIQ;MEHI;Error
|
||||
WO4CA;N1IP;Error
|
||||
WGS8F;EPS3;Error
|
||||
WCQIY;ZFNL;OK
|
||||
W74FU;X0ZB;OK
|
||||
VUW9Q;W4KH;OK
|
||||
V8HBK;29NW;Error
|
||||
V5J1T;ZFNL;OK
|
||||
V1GG0;ICWE;OK
|
||||
UUNDE;EXV3;OK
|
||||
UPX7E;PFBH;Error
|
||||
UGKXM;5JZN;OK
|
||||
U9UG9;2882;OK
|
||||
TSE8O;XRG2;Error
|
||||
TQQIB;SI92;OK
|
||||
TLLVS;ARTY;OK
|
||||
TKMV6;QRU2;OK
|
||||
TH2QA;R0GS;Error
|
||||
TB5RR;NBKW;OK
|
||||
T66SV;D8YG;OK
|
||||
SQ13L;TX35;Error
|
||||
SMSDM;F4N4;Error
|
||||
SI3WP;2HLI;Error
|
||||
SDERI;QVNH;Error
|
||||
SBLLT;5BF2;Error
|
||||
S4NUJ;FWAK;Error
|
||||
RVEWD;YMA9;OK
|
||||
RRSA0;HU2H;Error
|
||||
RGDSE;DWUE;Error
|
||||
R6DIW;GSV9;Error
|
||||
R3AGO;PYDN;Error
|
||||
R1C6R;7BNX;Error
|
||||
QOTSI;MEHI;Error
|
||||
QMM5X;XPD9;Error
|
||||
QH8MK;BC31;Error
|
||||
Q5H11;QVNH;Error
|
||||
Q3FE0;SDGS;OK
|
||||
PU3JF;S2MI;Error
|
||||
PU3JF;FX7J;OK
|
||||
PRF4N;TQUJ;Error
|
||||
PHBAF;PRW7;OK
|
||||
PB6G5;EIPO;Error
|
||||
P8ZJ5;3A2Q;OK
|
||||
P34UA;W4KH;OK
|
||||
OZNJS;SP8I;OK
|
||||
OYFZZ;5EYM;Error
|
||||
OO9YN;CE4Q;Error
|
||||
OEZY2;D29M;OK
|
||||
O1D4G;S41M;Error
|
||||
N62UY;ICWE;OK
|
||||
MWYVH;C8Z2;Error
|
||||
MRVHM;PFBH;Error
|
||||
MJ13E;VKF3;Error
|
||||
ME6BN;W4KH;OK
|
||||
LWQ1L;TQUJ;OK
|
||||
LW02D;4DDN;OK
|
||||
LVLC1;O6WN;Error
|
||||
LVE40;PYDN;Error
|
||||
LQH6F;YCRZ;OK
|
||||
LMQ27;DWUE;OK
|
||||
L8CZE;RTXJ;OK
|
||||
L6RT3;TX35;Error
|
||||
L2QHP;B2QZ;OK
|
||||
KOJKH;2DPE;OK
|
||||
KOEK2;XHJP;Error
|
||||
K3YSH;JEQS;OK
|
||||
JR6B8;SZ51;Error
|
||||
JIS9P;BTR6;OK
|
||||
J6O2J;AII4;OK
|
||||
IY2EI;P25G;Error
|
||||
IR9XI;XPD9;OK
|
||||
IFCGL;SQS8;OK
|
||||
I49PQ;SZ51;OK
|
||||
GVJL4;XNXZ;OK
|
||||
GSR9K;55V3;Error
|
||||
GORER;B69I;OK
|
||||
GMERC;YCRZ;OK
|
||||
GJAWO;PRW7;Error
|
||||
G5EM7;PBQ5;OK
|
||||
FYADB;V05Q;Error
|
||||
FQEVM;8DED;OK
|
||||
FN2ZA;ICWE;Error
|
||||
FMY2D;4MEA;Error
|
||||
EUQ1M;TVVU;Error
|
||||
ESRAF;0T71;OK
|
||||
ER3JT;VCD8;OK
|
||||
EJHHA;ACYP;OK
|
||||
EFPW5;9X4V;OK
|
||||
EC1YV;M284;Error
|
||||
E24VL;24TG;OK
|
||||
DZEQJ;MSF2;OK
|
||||
DX3TN;V05Q;Error
|
||||
DJO3L;SJPV;OK
|
||||
DIXZD;YMA9;Error
|
||||
DIGB5;EDII;OK
|
||||
DFGMB;EHND;Error
|
||||
D34C2;YCRZ;OK
|
||||
COTWD;WFK8;OK
|
||||
CN37J;FOAM;OK
|
||||
CMBIK;LM9M;Error
|
||||
CJLIM;ZFNL;OK
|
||||
C95YJ;4PKB;Error
|
||||
C5FQR;DWUE;OK
|
||||
C3QHX;WUUF;Error
|
||||
BYG1U;2882;OK
|
||||
BUE8Q;FARW;Error
|
||||
BT7XY;SZ51;Error
|
||||
BHFY0;29NW;OK
|
||||
B4VTE;64PV;OK
|
||||
B2SLO;D29M;Error
|
||||
AZRTF;FOAM;Error
|
||||
AYNQO;T4V4;Error
|
||||
AQKL0;AII4;OK
|
||||
AQJH9;QVNH;Error
|
||||
AO5ZW;PRJA;OK
|
||||
AO5ZW;9X4V;OK
|
||||
AMBLP;MEHI;Error
|
||||
9UKTM;FOAM;OK
|
||||
9SC2K;X7S3;Error
|
||||
9POHW;9X4V;OK
|
||||
990B1;SCFY;OK
|
||||
97KG6;U1D1;OK
|
||||
91KC1;QK0I;Error
|
||||
8YC3S;ICWE;Error
|
||||
8NM3T;RTXJ;OK
|
||||
8L88L;NGZ9;Error
|
||||
8HWP6;SDGS;OK
|
||||
8AJ9T;86II;Error
|
||||
8A8FT;55V3;Error
|
||||
83P67;0N2X;OK
|
||||
7RP8O;6C3I;OK
|
||||
7PAZY;SZ51;OK
|
||||
7PAZY;D8YG;OK
|
||||
7L3K6;W4KH;OK
|
||||
74FE7;TX35;Error
|
||||
74BDS;2V2J;Error
|
||||
712AV;FVPH;OK
|
||||
70SQB;SZXV;Error
|
||||
6Q51I;PRW7;OK
|
||||
6PW1Z;ML9P;Error
|
||||
6CAGY;EHND;Error
|
||||
6359P;02LG;OK
|
||||
5XNOX;0FX7;OK
|
||||
5MHY8;RTXJ;OK
|
||||
5M350;LM9M;Error
|
||||
5I6ZW;SI92;OK
|
||||
5I6ZW;BTR6;Error
|
||||
5GPJ9;SZ51;OK
|
||||
5FWYC;LM9M;Error
|
||||
583CX;B51W;OK
|
||||
573GG;XPD9;Error
|
||||
4YLPA;PH7F;Error
|
||||
4RY8Y;2HLI;Error
|
||||
4ONGU;H44A;Error
|
||||
4NB1R;FVPH;Error
|
||||
4GI7V;NBKW;Error
|
||||
3RRU3;V05Q;OK
|
||||
3Q5O4;BC31;OK
|
||||
3OUOJ;3A2Q;Error
|
||||
3EN9P;VKF3;Error
|
||||
3EN9P;29NW;Error
|
||||
3DX9I;NZW9;Error
|
||||
3CGFX;YM99;OK
|
||||
3BHYG;LEDT;OK
|
||||
2Z70A;7AJW;Error
|
||||
2TDAX;OF8A;OK
|
||||
2TDAX;NZW9;Error
|
||||
2P5B1;OXS5;OK
|
||||
2P0RS;F4N4;OK
|
||||
2CA7C;5JZN;Error
|
||||
2BCKD;QMWG;Error
|
||||
2AUCZ;FU3M;Error
|
||||
1PXRN;XPD9;OK
|
||||
1G0XB;VCD8;OK
|
||||
1D08J;SDGS;OK
|
||||
1D08J;OXS5;Error
|
||||
1AJRT;6S6G;OK
|
||||
16Z41;EXFN;OK
|
||||
0X1VU;ICWE;OK
|
||||
0N3JO;IMPQ;Error
|
||||
0BOFM;ZHMP;Error
|
||||
BIN
QuickSort/bin/frame/AllTests$QuickSortAComplexityTest.class
Normal file
BIN
QuickSort/bin/frame/AllTests$QuickSortAComplexityTest.class
Normal file
Binary file not shown.
BIN
QuickSort/bin/frame/AllTests$QuickSortASortingTest.class
Normal file
BIN
QuickSort/bin/frame/AllTests$QuickSortASortingTest.class
Normal file
Binary file not shown.
BIN
QuickSort/bin/frame/AllTests$QuickSortBComplexityTest.class
Normal file
BIN
QuickSort/bin/frame/AllTests$QuickSortBComplexityTest.class
Normal file
Binary file not shown.
BIN
QuickSort/bin/frame/AllTests$QuickSortBSortingTest.class
Normal file
BIN
QuickSort/bin/frame/AllTests$QuickSortBSortingTest.class
Normal file
Binary file not shown.
BIN
QuickSort/bin/frame/AllTests$TestFileProvider$1.class
Normal file
BIN
QuickSort/bin/frame/AllTests$TestFileProvider$1.class
Normal file
Binary file not shown.
BIN
QuickSort/bin/frame/AllTests$TestFileProvider$2.class
Normal file
BIN
QuickSort/bin/frame/AllTests$TestFileProvider$2.class
Normal file
Binary file not shown.
BIN
QuickSort/bin/frame/AllTests$TestFileProvider.class
Normal file
BIN
QuickSort/bin/frame/AllTests$TestFileProvider.class
Normal file
Binary file not shown.
BIN
QuickSort/bin/frame/AllTests.class
Normal file
BIN
QuickSort/bin/frame/AllTests.class
Normal file
Binary file not shown.
BIN
QuickSort/bin/frame/LibraryFileReader.class
Normal file
BIN
QuickSort/bin/frame/LibraryFileReader.class
Normal file
Binary file not shown.
BIN
QuickSort/bin/frame/SortArray.class
Normal file
BIN
QuickSort/bin/frame/SortArray.class
Normal file
Binary file not shown.
BIN
QuickSort/bin/frame/SortingLab.class
Normal file
BIN
QuickSort/bin/frame/SortingLab.class
Normal file
Binary file not shown.
BIN
QuickSort/bin/lab/QuickSort.class
Normal file
BIN
QuickSort/bin/lab/QuickSort.class
Normal file
Binary file not shown.
BIN
QuickSort/bin/lab/QuickSortA.class
Normal file
BIN
QuickSort/bin/lab/QuickSortA.class
Normal file
Binary file not shown.
BIN
QuickSort/bin/lab/QuickSortB.class
Normal file
BIN
QuickSort/bin/lab/QuickSortB.class
Normal file
Binary file not shown.
BIN
QuickSort/bin/lab/SortingItem.class
Normal file
BIN
QuickSort/bin/lab/SortingItem.class
Normal file
Binary file not shown.
271
QuickSort/src/frame/AllTests.java
Executable file
271
QuickSort/src/frame/AllTests.java
Executable file
@ -0,0 +1,271 @@
|
||||
package frame;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FilenameFilter;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.TestInstance;
|
||||
import org.junit.jupiter.api.TestInstance.Lifecycle;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.ArgumentsProvider;
|
||||
import org.junit.jupiter.params.provider.ArgumentsSource;
|
||||
|
||||
import lab.SortingItem;
|
||||
|
||||
/**
|
||||
* Do NOT change anything in this class!
|
||||
*
|
||||
* The test cases defined by this class are used to test if the input file was
|
||||
* correctly sorted. This class is also responsible for outputting to the
|
||||
* console.
|
||||
*
|
||||
*/
|
||||
|
||||
@DisplayName("QuickSort tests")
|
||||
class AllTests {
|
||||
|
||||
protected static int NrOfTestFiles;
|
||||
protected int correct = 0;
|
||||
protected Duration timeout = Duration.ofSeconds(3);
|
||||
|
||||
static class TestFileProvider implements ArgumentsProvider {
|
||||
|
||||
@Override
|
||||
public Stream<Arguments> provideArguments(ExtensionContext context) throws Exception {
|
||||
File dir = new File(System.getProperty("user.dir"));
|
||||
FilenameFilter filter;
|
||||
if (context.getParent().get().getDisplayName().startsWith("QuickSortB Complexity")) {
|
||||
filter = new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.startsWith("TestFile") && !name.contains("_d_");
|
||||
}
|
||||
};
|
||||
} else {
|
||||
filter = new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.startsWith("TestFile");
|
||||
}
|
||||
};
|
||||
}
|
||||
String[] inputFiles = dir.list(filter);
|
||||
if (inputFiles == null) {
|
||||
throw new FileNotFoundException("Error: No TestFiles found!");
|
||||
} else {
|
||||
Arrays.sort(inputFiles);
|
||||
NrOfTestFiles = inputFiles.length;
|
||||
List<Arguments> tests = new ArrayList<Arguments>();
|
||||
for (int i = 0; i < inputFiles.length; i++) {
|
||||
tests.add(Arguments.of(inputFiles[i], SortingLab.readFile(inputFiles[i])));
|
||||
}
|
||||
return tests.stream();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean sortingTester(SortArray records) {
|
||||
boolean sorted = true;
|
||||
SortingItem lastRecord = records.getElementAt(0);
|
||||
for (int i = 1; i < records.getNumberOfItems() && sorted; i++) {
|
||||
SortingItem actualRecord = records.getElementAt(i);
|
||||
sorted = (actualRecord.BookSerialNumber.compareTo(lastRecord.BookSerialNumber) > 0)
|
||||
|| ((actualRecord.BookSerialNumber.compareTo(lastRecord.BookSerialNumber) == 0)
|
||||
&& ((actualRecord.ReaderID.compareTo(lastRecord.ReaderID) > 0)
|
||||
|| ((actualRecord.ReaderID.compareTo(lastRecord.ReaderID) == 0))));
|
||||
lastRecord = actualRecord;
|
||||
}
|
||||
return sorted;
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestInstance(Lifecycle.PER_CLASS)
|
||||
@DisplayName("QuickSortA Sorting")
|
||||
class QuickSortASortingTest {
|
||||
|
||||
@BeforeAll
|
||||
public void init() {
|
||||
correct = 0;
|
||||
System.out.println("Starting QuicksortA tests!");
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public void tearDown() {
|
||||
System.out.println("Correct QuicksortA sortings: " + correct + " out of " + NrOfTestFiles + " tests\n");
|
||||
}
|
||||
|
||||
@DisplayName("Tests")
|
||||
@ParameterizedTest(name = "QuicksortA sorting test with input: {0}")
|
||||
@ArgumentsSource(TestFileProvider.class)
|
||||
public void testQuicksortA(String inputFile, SortArray records) {
|
||||
assertTimeoutPreemptively(timeout, () -> {
|
||||
SortingLab.QuicksortA(records, 0, records.getNumberOfItems() - 1);
|
||||
}, () -> {
|
||||
System.out.println("QuicksortA [" + inputFile + "]: Execution timed out after: " + timeout.getSeconds()
|
||||
+ " seconds");
|
||||
return "Test failed!";
|
||||
});
|
||||
int readOps = records.getReadingOperations();
|
||||
int writeOps = records.getWritingOperations();
|
||||
assertTrue(sortingTester(records), () -> {
|
||||
System.out.println("QuicksortA [" + inputFile + "]: Wrong order!");
|
||||
return "Test failed!";
|
||||
});
|
||||
System.out.println(
|
||||
"QuicksortA [" + inputFile + "]: Correct order! Read Ops: " + readOps + "; Write Ops: " + writeOps);
|
||||
correct++;
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestInstance(Lifecycle.PER_CLASS)
|
||||
@DisplayName("QuickSortB Sorting")
|
||||
class QuickSortBSortingTest {
|
||||
|
||||
@BeforeAll
|
||||
public void init() {
|
||||
correct = 0;
|
||||
System.out.println("Starting QuicksortB tests!");
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public void tearDown() {
|
||||
System.out.println("Correct QuicksortB sortings: " + correct + " out of " + NrOfTestFiles + " tests\n");
|
||||
}
|
||||
|
||||
@DisplayName("Tests")
|
||||
@ParameterizedTest(name = "QuicksortB sorting test with input: {0}")
|
||||
@ArgumentsSource(TestFileProvider.class)
|
||||
public void testQuicksortB(String inputFile, SortArray records) {
|
||||
assertTimeoutPreemptively(timeout, () -> {
|
||||
SortingLab.QuicksortB(records, 0, records.getNumberOfItems() - 1);
|
||||
}, () -> {
|
||||
System.out.println("QuicksortB [" + inputFile + "]: Execution timed out after: " + timeout.getSeconds()
|
||||
+ " seconds");
|
||||
return "Test failed!";
|
||||
});
|
||||
int readOps = records.getReadingOperations();
|
||||
int writeOps = records.getWritingOperations();
|
||||
assertTrue(sortingTester(records), () -> {
|
||||
System.out.println("QuicksortB [" + inputFile + "]: Wrong order!");
|
||||
return "Test failed!";
|
||||
});
|
||||
System.out.println(
|
||||
"QuicksortB [" + inputFile + "]: Correct order! Read Ops: " + readOps + "; Write Ops: " + writeOps);
|
||||
correct++;
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestInstance(Lifecycle.PER_CLASS)
|
||||
@DisplayName("QuickSortA Complexity")
|
||||
class QuickSortAComplexityTest {
|
||||
|
||||
@BeforeAll
|
||||
public void init() {
|
||||
correct = 0;
|
||||
System.out.println("Starting QuicksortA complexity tests!");
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public void tearDown() {
|
||||
System.out.println(
|
||||
"Passed complexity tests for QuicksortA: " + correct + " out of " + NrOfTestFiles + " tests\n");
|
||||
}
|
||||
|
||||
private void complexityTesterA(SortArray records, String inputFile, int readOps) {
|
||||
int n = records.getNumberOfItems();
|
||||
double nlogn = n * (Math.log(n) / Math.log(2)) * 5;
|
||||
assertTrue(readOps > 0);
|
||||
if (inputFile.contains("_r_")) {
|
||||
assertTrue(readOps < nlogn, () -> {
|
||||
System.out.println("QuickSortA complexity test failed for file: " + inputFile
|
||||
+ " - complexity out of allowed range: O(nlog(n)) required!");
|
||||
return "Test failed!";
|
||||
});
|
||||
} else if (inputFile.contains("_a_") || inputFile.contains("_d_")) {
|
||||
assertTrue(readOps > Math.pow(n, 2) / 2, () -> {
|
||||
System.out.println("QuickSortA complexity test failed for file: " + inputFile
|
||||
+ " - complexity out of allowed range: O(n^2) required!");
|
||||
return "Test failed!";
|
||||
});
|
||||
}
|
||||
correct++;
|
||||
}
|
||||
|
||||
@DisplayName("Tests")
|
||||
@ParameterizedTest(name = "QuicksortA complexity test with input: {0}")
|
||||
@ArgumentsSource(TestFileProvider.class)
|
||||
public void testQuicksortAComplexity(String inputFile, SortArray records) {
|
||||
assertTimeoutPreemptively(timeout, () -> {
|
||||
SortingLab.QuicksortA(records, 0, records.getNumberOfItems() - 1);
|
||||
}, () -> {
|
||||
System.out.println("Complexity QuicksortA [" + inputFile + "]: Execution timed out after: "
|
||||
+ timeout.getSeconds() + " seconds");
|
||||
return "Test failed!";
|
||||
});
|
||||
int readOps = records.getReadingOperations();
|
||||
complexityTesterA(records, inputFile, readOps);
|
||||
System.out.println("Complexity QuicksortA [" + inputFile + "]: Complexity within allowed range!");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestInstance(Lifecycle.PER_CLASS)
|
||||
@DisplayName("QuickSortB Complexity")
|
||||
class QuickSortBComplexityTest {
|
||||
|
||||
@BeforeAll
|
||||
public void init() {
|
||||
correct = 0;
|
||||
System.out.println("Starting QuicksortB complexity tests!");
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public void tearDown() {
|
||||
System.out.println(
|
||||
"Passed complexity tests for QuicksortB: " + correct + " out of " + NrOfTestFiles + " tests\n");
|
||||
}
|
||||
|
||||
private void complexityTesterB(SortArray records, String inputFile, int readOps) {
|
||||
int n = records.getNumberOfItems();
|
||||
double nlogn = n * (Math.log(n) / Math.log(2)) * 5;
|
||||
|
||||
assertTrue(readOps > 0);
|
||||
assertTrue(readOps < nlogn, () -> {
|
||||
System.out.println("QuickSortB complexity test failed for file: " + inputFile
|
||||
+ " - complexity out of allowed range: O(nlog(n)) required!");
|
||||
return "Test failed!";
|
||||
});
|
||||
correct++;
|
||||
}
|
||||
|
||||
@DisplayName("Tests")
|
||||
@ParameterizedTest(name = "QuicksortB complexity test with input: {0}")
|
||||
@ArgumentsSource(TestFileProvider.class)
|
||||
public void testQuicksortBComplexity(String inputFile, SortArray records) {
|
||||
assertTimeoutPreemptively(timeout, () -> {
|
||||
SortingLab.QuicksortB(records, 0, records.getNumberOfItems() - 1);
|
||||
}, () -> {
|
||||
System.out.println("Complexity QuicksortB [" + inputFile + "]: Execution timed out after: "
|
||||
+ timeout.getSeconds() + " seconds");
|
||||
return "Test failed!";
|
||||
});
|
||||
int readOps = records.getReadingOperations();
|
||||
complexityTesterB(records, inputFile, readOps);
|
||||
System.out.println("Complexity QuicksortB [" + inputFile + "]: Complexity within allowed range!");
|
||||
}
|
||||
}
|
||||
}
|
||||
67
QuickSort/src/frame/LibraryFileReader.java
Executable file
67
QuickSort/src/frame/LibraryFileReader.java
Executable file
@ -0,0 +1,67 @@
|
||||
package frame;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Do NOT change anything in this class!
|
||||
*
|
||||
* This class contains a method for reading the input files into a Vector
|
||||
* structure.
|
||||
*
|
||||
* @author Stefan Kropp
|
||||
*/
|
||||
public class LibraryFileReader {
|
||||
|
||||
private String filename = null;
|
||||
private ArrayList<String[]> data = null;
|
||||
|
||||
/**
|
||||
* The file should be in the same directory as the java application. if not,
|
||||
* you have to provide the absolute or relative path information within the
|
||||
* filename string.
|
||||
*
|
||||
* @param filename
|
||||
* the name of the file to read
|
||||
*/
|
||||
public LibraryFileReader(String filename) {
|
||||
this.filename = filename;
|
||||
this.data = new ArrayList<String[]>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a file, specified in the private field filename and returns the
|
||||
* information read. The file should have the same format as specified in
|
||||
* the first lab.
|
||||
*
|
||||
* @return Returns a Vector which holds 3-dimensional String arrays with
|
||||
* following format: BookSerialNumber, ReaderID, Status. In the case
|
||||
* an error occured null is returned.
|
||||
*/
|
||||
public ArrayList<String[]> readFile() {
|
||||
try {
|
||||
FileReader fr = new FileReader(filename);
|
||||
BufferedReader in = new BufferedReader(fr);
|
||||
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
data.add(line.split(";"));
|
||||
}
|
||||
|
||||
in.close();
|
||||
fr.close();
|
||||
|
||||
return data;
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
103
QuickSort/src/frame/SortArray.java
Executable file
103
QuickSort/src/frame/SortArray.java
Executable file
@ -0,0 +1,103 @@
|
||||
package frame;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import lab.SortingItem;
|
||||
|
||||
/**
|
||||
* Do NOT change anything in this class!
|
||||
*
|
||||
* The SortArray class provides simple basic functions, to store a list of
|
||||
* sortingItems to track the number of operations.
|
||||
*
|
||||
* This class contains two members (readingOperations and writingOperations)
|
||||
* that act as counters for the number of accesses to the arrays to be sorted.
|
||||
* These are used by the JUnit tests to construct the output. The methods
|
||||
* provided in this class should be sufficient for you to sort the records of
|
||||
* the input files.
|
||||
*
|
||||
* @author Stefan Kropp
|
||||
*/
|
||||
|
||||
public class SortArray {
|
||||
|
||||
private int numberOfItems;
|
||||
|
||||
private ArrayList<SortingItem> listOfItems;
|
||||
|
||||
private int readingOperations;
|
||||
private int writingOperations;
|
||||
|
||||
/**
|
||||
* @param numberOfItems
|
||||
* number of items to hold
|
||||
*/
|
||||
public SortArray(ArrayList<String[]> items) {
|
||||
numberOfItems = items.size();
|
||||
readingOperations = 0;
|
||||
writingOperations = 0;
|
||||
listOfItems = new ArrayList<>();
|
||||
|
||||
for (String[] element : items) {
|
||||
SortingItem s = new SortingItem();
|
||||
s.BookSerialNumber = element[0];
|
||||
s.ReaderID = element[1];
|
||||
s.Status = element[2];
|
||||
listOfItems.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the elements at index. if index is >= numberOfItems or less then
|
||||
* zero an IndexOutOfBoundException will occur.
|
||||
*
|
||||
* @param index
|
||||
* the index of the Elements to set
|
||||
* @param record
|
||||
* a 3-dimensional record which holds: BookSerialNumber,
|
||||
* ReaderID, Status
|
||||
*/
|
||||
public void setElementAt(int index, SortingItem record) {
|
||||
this.listOfItems.set(index, record);
|
||||
|
||||
writingOperations++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the information stored at position Index. if index is >=
|
||||
* numberOfItems or less then zero an IndexOutOfBoundException will occur.
|
||||
*
|
||||
* @param index
|
||||
* Index defines which elements to retrieve from the SortArray
|
||||
* @return Returns a 3-dimensional String array with following format:
|
||||
* BookSerialNumber, ReaderID, Status.
|
||||
*
|
||||
*/
|
||||
public SortingItem getElementAt(int index) {
|
||||
|
||||
SortingItem result = new SortingItem(this.listOfItems.get(index));
|
||||
readingOperations++;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the number of reading operations.
|
||||
*/
|
||||
public int getReadingOperations() {
|
||||
return readingOperations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the number of writing operations.
|
||||
*/
|
||||
public int getWritingOperations() {
|
||||
return writingOperations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the numberOfItems.
|
||||
*/
|
||||
public int getNumberOfItems() {
|
||||
return numberOfItems;
|
||||
}
|
||||
}
|
||||
61
QuickSort/src/frame/SortingLab.java
Executable file
61
QuickSort/src/frame/SortingLab.java
Executable file
@ -0,0 +1,61 @@
|
||||
package frame;
|
||||
|
||||
import lab.QuickSort;
|
||||
import lab.QuickSortA;
|
||||
import lab.QuickSortB;
|
||||
|
||||
public class SortingLab {
|
||||
|
||||
/**
|
||||
* Reads the file specified in filename and returns the data as a SortArray
|
||||
*
|
||||
* @param filename
|
||||
* the path and name of the file to read
|
||||
* @return Returns a SortArray filled with the data of the input file
|
||||
*/
|
||||
public static SortArray readFile(String filename) {
|
||||
LibraryFileReader fileReader = new LibraryFileReader(filename);
|
||||
return new SortArray(fileReader.readFile());
|
||||
}
|
||||
|
||||
static QuickSort sortingMethod;
|
||||
|
||||
/**
|
||||
* Uses the Quicksort A algorithm to sort the records (the pivot is the
|
||||
* first element in the list)
|
||||
*
|
||||
* @param records
|
||||
* unsorted SortArray data
|
||||
* @param left
|
||||
* the left bound for the algorithm
|
||||
* @param right
|
||||
* the right bound for the algorithm
|
||||
* @return Returns the sorted SortArray
|
||||
*/
|
||||
public static SortArray QuicksortA(SortArray records, int left, int right) {
|
||||
|
||||
sortingMethod = new QuickSortA();
|
||||
sortingMethod.Quicksort(records, left, right);
|
||||
return records;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the Quicksort B algorithm to sort the records (the pivot is the
|
||||
* median between first, last and middle element in the list)
|
||||
*
|
||||
* @param records
|
||||
* unsorted SortArray data
|
||||
* @param left
|
||||
* the left bound for the algorithm
|
||||
* @param right
|
||||
* the right bound for the algorithm
|
||||
* @return Returns the sorted SortArray
|
||||
*/
|
||||
public static SortArray QuicksortB(SortArray records, int left, int right) {
|
||||
|
||||
sortingMethod = new QuickSortB();
|
||||
sortingMethod.Quicksort(records, left, right);
|
||||
return records;
|
||||
}
|
||||
|
||||
}
|
||||
17
QuickSort/src/lab/QuickSort.java
Executable file
17
QuickSort/src/lab/QuickSort.java
Executable file
@ -0,0 +1,17 @@
|
||||
package lab;
|
||||
|
||||
import frame.SortArray;
|
||||
|
||||
/**
|
||||
* Abstract superclass for the Quicksort algorithm.
|
||||
*
|
||||
* @author NAJI
|
||||
*/
|
||||
public abstract class QuickSort {
|
||||
|
||||
// DO NOT modify this method
|
||||
public abstract void Quicksort(SortArray records, int left, int right);
|
||||
|
||||
// You may add additional methods here
|
||||
|
||||
}
|
||||
28
QuickSort/src/lab/QuickSortA.java
Executable file
28
QuickSort/src/lab/QuickSortA.java
Executable file
@ -0,0 +1,28 @@
|
||||
package lab;
|
||||
|
||||
import frame.SortArray;
|
||||
|
||||
public class QuickSortA extends QuickSort {
|
||||
|
||||
/**
|
||||
* Quicksort algorithm implementation to sort a SorrtArray by choosing the
|
||||
* pivot as the first (leftmost) element in the list
|
||||
*
|
||||
* @param records
|
||||
* - list of elements to be sorted as a SortArray
|
||||
* @param left
|
||||
* - the index of the left bound for the algorithm
|
||||
* @param right
|
||||
* - the index of the right bound for the algorithm
|
||||
* @return Returns the sorted list as SortArray
|
||||
*/
|
||||
@Override
|
||||
public void Quicksort(SortArray records, int left, int right) {
|
||||
// TODO
|
||||
// implement the Quicksort A algorithm to sort the records
|
||||
// (choose the pivot as the first (leftmost) element in the list)
|
||||
}
|
||||
|
||||
// You may add additional methods here
|
||||
|
||||
}
|
||||
29
QuickSort/src/lab/QuickSortB.java
Executable file
29
QuickSort/src/lab/QuickSortB.java
Executable file
@ -0,0 +1,29 @@
|
||||
package lab;
|
||||
|
||||
import frame.SortArray;
|
||||
|
||||
public class QuickSortB extends QuickSort {
|
||||
|
||||
/**
|
||||
* Quicksort algorithm implementation to sort a SorrtArray by choosing the
|
||||
* pivot as the median of the elements at positions (left,middle,right)
|
||||
*
|
||||
* @param records
|
||||
* - list of elements to be sorted as a SortArray
|
||||
* @param left
|
||||
* - the index of the left bound for the algorithm
|
||||
* @param right
|
||||
* - the index of the right bound for the algorithm
|
||||
* @return Returns the sorted list as SortArray
|
||||
*/
|
||||
@Override
|
||||
public void Quicksort(SortArray records, int left, int right) {
|
||||
// TODO
|
||||
// implement the Quicksort B algorithm to sort the records
|
||||
// (choose the pivot as the median value of the elements at position
|
||||
// (left (first),middle,right(last)))
|
||||
}
|
||||
|
||||
// You may add additional methods here
|
||||
|
||||
}
|
||||
29
QuickSort/src/lab/SortingItem.java
Executable file
29
QuickSort/src/lab/SortingItem.java
Executable file
@ -0,0 +1,29 @@
|
||||
package lab;
|
||||
|
||||
/**
|
||||
*
|
||||
* This class represents one entry of the list that has to be sorted.
|
||||
*
|
||||
*/
|
||||
public class SortingItem {
|
||||
|
||||
// DO NOT modify
|
||||
public String BookSerialNumber;
|
||||
public String ReaderID;
|
||||
public String Status;
|
||||
|
||||
// DO NOT modify
|
||||
public SortingItem() {
|
||||
|
||||
}
|
||||
|
||||
// DO NOT modify
|
||||
public SortingItem(SortingItem otherItem) {
|
||||
this.BookSerialNumber = otherItem.BookSerialNumber;
|
||||
this.ReaderID = otherItem.ReaderID;
|
||||
this.Status = otherItem.Status;
|
||||
}
|
||||
|
||||
// You may add additional methods here
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user