From 9a4e1c622e492eeec54a004ebecbd4c7d2b04074 Mon Sep 17 00:00:00 2001 From: pourchot Date: Wed, 29 Nov 2023 17:27:03 +0100 Subject: [PATCH] 29 Novembre --- DEV3.2/TP5/Fusion/Main.class | Bin 0 -> 2129 bytes DEV3.2/TP5/Fusion/Main.java | 55 ++++++++++++++ DEV3.2/TP6/Traces/Main.class | Bin 0 -> 1223 bytes DEV3.2/TP6/Traces/Main.java | 12 +++ DEV3.2/TP7/Prefixe/Main.class | Bin 0 -> 920 bytes DEV3.2/TP7/Prefixe/Main.java | 24 ++++++ DEV3.2/TP7/Prefixe/Noeud.class | Bin 0 -> 327 bytes DEV3.2/TP7/Prefixe/Noeud.java | 8 ++ DEV3.2/TP7/Prefixe/NoeudChiffre.class | Bin 0 -> 888 bytes DEV3.2/TP7/Prefixe/NoeudChiffre.java | 11 +++ DEV3.2/TP7/Prefixe/NoeudOperation.class | Bin 0 -> 1385 bytes DEV3.2/TP7/Prefixe/NoeudOperation.java | 21 ++++++ DEV3.2/TP7/Repertoires/Main.class | Bin 0 -> 319 bytes DEV3.2/TP7/Repertoires/Main.java | 8 ++ DEV3.2/TP7/Repertoires/Noeud.class | Bin 0 -> 851 bytes DEV3.2/TP7/Repertoires/Noeud.java | 62 ++++++++++++++++ DEV3.2/TP7/Repertoires/Repertoires.class | Bin 0 -> 2050 bytes DEV3.2/TP7/Repertoires/Repertoires.java | 50 +++++++++++++ .../TP7/Repertoires/toto/dossier 1/fichier 1 | 0 .../TP7/Repertoires/toto/dossier 1/fichier 2 | 0 .../TP7/Repertoires/toto/dossier 2/fichier 3 | 0 DEV3.2/TP7/Repertoires/toto/fichier 4 | 0 DEV3.2/TP8/Tri/Main.class | Bin 0 -> 704 bytes DEV3.2/TP8/Tri/Main.java | 16 ++++ DEV3.2/TP8/Tri/Noeud.class | Bin 0 -> 476 bytes DEV3.2/TP8/Tri/Noeud.java | 19 +++++ DEV3.2/TP8/Tri/Tri.class | Bin 0 -> 1638 bytes DEV3.2/TP8/Tri/Tri.java | 69 ++++++++++++++++++ 28 files changed, 355 insertions(+) create mode 100644 DEV3.2/TP5/Fusion/Main.class create mode 100644 DEV3.2/TP5/Fusion/Main.java create mode 100644 DEV3.2/TP6/Traces/Main.class create mode 100644 DEV3.2/TP6/Traces/Main.java create mode 100644 DEV3.2/TP7/Prefixe/Main.class create mode 100644 DEV3.2/TP7/Prefixe/Main.java create mode 100644 DEV3.2/TP7/Prefixe/Noeud.class create mode 100644 DEV3.2/TP7/Prefixe/Noeud.java create mode 100644 DEV3.2/TP7/Prefixe/NoeudChiffre.class create mode 100644 DEV3.2/TP7/Prefixe/NoeudChiffre.java create mode 100644 DEV3.2/TP7/Prefixe/NoeudOperation.class create mode 100644 DEV3.2/TP7/Prefixe/NoeudOperation.java create mode 100644 DEV3.2/TP7/Repertoires/Main.class create mode 100644 DEV3.2/TP7/Repertoires/Main.java create mode 100644 DEV3.2/TP7/Repertoires/Noeud.class create mode 100644 DEV3.2/TP7/Repertoires/Noeud.java create mode 100644 DEV3.2/TP7/Repertoires/Repertoires.class create mode 100644 DEV3.2/TP7/Repertoires/Repertoires.java create mode 100644 DEV3.2/TP7/Repertoires/toto/dossier 1/fichier 1 create mode 100644 DEV3.2/TP7/Repertoires/toto/dossier 1/fichier 2 create mode 100644 DEV3.2/TP7/Repertoires/toto/dossier 2/fichier 3 create mode 100644 DEV3.2/TP7/Repertoires/toto/fichier 4 create mode 100644 DEV3.2/TP8/Tri/Main.class create mode 100644 DEV3.2/TP8/Tri/Main.java create mode 100644 DEV3.2/TP8/Tri/Noeud.class create mode 100644 DEV3.2/TP8/Tri/Noeud.java create mode 100644 DEV3.2/TP8/Tri/Tri.class create mode 100644 DEV3.2/TP8/Tri/Tri.java diff --git a/DEV3.2/TP5/Fusion/Main.class b/DEV3.2/TP5/Fusion/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..cff3d89b7680a56d7817fd166b026a3f2e090693 GIT binary patch literal 2129 zcmaJ>T~ixX7=BI&S+Z^mg#x8gL`pFvh1gPCZD_R(M$k}NgJ6qahh%{*%WlkWn86wE z{0q)FUU<=)UU-9EP^Qi>Ui(M1f5Bp7(v;bAJ2l@d1Dbm#T4i)T8??EzO`!B7UinV70oMKPQ|PVOs0zW<+jY$eap_? zsMX}ojQM5V%#BAc3mhx?vb;Gjs|{DllC|zgzh0x;#b{^Kp)XrH>)C?sNvn9v3Kx8$aocb&5Imo0yTBhQzP z?+J`Wh4y?U2=oN$Y{ekyszS7x?v@-KhP9;Oo>J#Cfzcy5EN9!@G_#>m$f_XAzFXVT z@CBccqU&zfs{+QHx^a11dY(zD-!)Th_y`MORyq~i^hU#jjhh&V)gaOoP|Lx^ovImO z-h34rrO+%$!$n@&cFFS1oCYay?z#A)xCspXza1|?4EUWgW==>dNUlg|BA#OwB>JN z;^E)FXLfla7WnKVwDNo$9rT&R82j@u@G@5o#Gau`V_E&l`CxG73~hL28|Zh~EA%1a zWe85RH2W5`C+Q=!Zn6bVKu0%&Jwczn0a6mNrvc1B17?^od>$Gw4|y!cgX=1$A35MR z!@pWnc?zkKMtYYP9YL%~j`VQ!?GNZoHzgsx+nTKOK3*zj_F-^f?Bm!G-w|d5%=R!@ zj!>4XjJ?3wEN4qNixrFp{1b=|i?gCBMPzJGga6_cc9)Msvtt~#+W4_!*otCp_3#wK>;stWs1K`e2}L| u^>RS52k~bxLNN!PB0)`0lh>NI2uaof#KF24F_zLG8oWIHcTmJwf`2)rP literal 0 HcmV?d00001 diff --git a/DEV3.2/TP5/Fusion/Main.java b/DEV3.2/TP5/Fusion/Main.java new file mode 100644 index 0000000..55fc95a --- /dev/null +++ b/DEV3.2/TP5/Fusion/Main.java @@ -0,0 +1,55 @@ +import java.util.*; + +public class Main{ + + public static ArrayDeque scinder(ArrayDeque file){ + ArrayDeque nouveaufile = new ArrayDeque(file.size()/2); + + for (int i=0; i<(file.size()/2); i++){ + nouveaufile.add(file.poll()); + } + + return nouveaufile; + } + + public static ArrayDeque fusionner(ArrayDeque fileun, ArrayDeque filedeux){ + + for (int i=0; i<(filedeux.size()); i++){ + fileun.add(filedeux.poll()); + } + + return fileun; + } + + public static ArrayDeque trier(ArrayDeque file){ + switch (file.size()){ + case 1: + return file; + case 2: + if (file.getFirst()>file.getLast()){ + file.add(file.poll()); + } + return file; + default: + ArrayDeque nouveaufile = new ArrayDeque(file.size()/2); + nouveaufile=scinder(file); + return fusionner(trier(nouveaufile),trier(file)); + + } + + } + + public static void main(String[] args) { + ArrayDeque file = new ArrayDeque(args.length); + + for (int i=0; i?NSm^7=8{Q2bLujMa!?U)bJDgw8AWr!Z%P#F6oVb&^f_~SJ zN`G_#T}YQrlxUt%mOKC* zI^rA)Iu@~{BaLMpH*izOE!^g~qvI}Cblk&zhQ1BkR<3eHJug+oF1x*9JcuBpV-*iM z)^t3=V`AuGQ}h|Vm%ID2q==huYAC}@6Tz-?L6Sdl=HFJ*5z2PDaEcX2iZVn0o>c3m z>33RmL`k}2OUm2Vt7TkJMsgOBVFEhu_-iN zC2Qoc8{|&5svCCt6=|VJ5h-c}5VHL2!IJ{MUabqsXjsPvLx5=v!!=QrS=%ZJ^~O*Y z+PO+tiaMJ~btv7=Z1>tJKEr^2eccSGgSyAZBt?>)K&K+pac9L4Dh@q?0v;>v|%5?5xnnXwAx&u*#-%r&@`bj*i+yIxJm@ z#b#Ze6W%%f=iEsfA}eT0NaYO2bB5`E`a6#s!^HpNFbVGs_kID;6(CN}3v?Q%mC@QW z_Z{pDZRq`_XV^Ce5k(*RY43%;r_>Ow%Rdmv%^xDjkY6}Nh+${(5Iqc^F#Hu^+H-~@ zM1XIIe*W{@Lk;+-BZNz(2qjEpI1&^zN;T4S^1d#;2pl89F~Bj%ksL!1Lw@owHfhy} U$P;YgDSf6U=^UZ+Rr+813xgUn;Q#;t literal 0 HcmV?d00001 diff --git a/DEV3.2/TP6/Traces/Main.java b/DEV3.2/TP6/Traces/Main.java new file mode 100644 index 0000000..d8b2cac --- /dev/null +++ b/DEV3.2/TP6/Traces/Main.java @@ -0,0 +1,12 @@ +import java.util.*; + +public class Main { + public static void main (String[] args){ + Map dico =Thread.getAllStackTraces(); + Set> tab=dico.entrySet(); + Iterator ite=tab.iterator(); + for (;ite.hasNext();){ + System.out.println(ite.next()+"\n"); + } + } +} \ No newline at end of file diff --git a/DEV3.2/TP7/Prefixe/Main.class b/DEV3.2/TP7/Prefixe/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..d8b403f5834c378351be25d6614c746d205035cf GIT binary patch literal 920 zcmZ`&T~8B16g|^znRdHvVcX(I6+!&iE-gj;K&7GvV`9=mOpOT|AC|JETgrA_c8$LK zC-l)5p4Frzk~BX1;7{=f7!~gfKA>PWbLY;TbMKsUXZFjlPXhpRxT7MANseIb zjtj!OD2%~TjKfsHF%?HCj&dB+92FHQ%y3*%k-?0Lam;dD=D5NT^_;HFFk0(aFRV%! zINi!!-?v`fv!93dJVT=4th-ha`UEnM1XcH=UCUjsGy>mo*XI`~aj5FJPO!kB7{$kQ z&SGzkN@Qw|YcGYHtG55hS`{ZpH!a5{0>;zBbwpyS5m?QQy5&hc$5oDN3~Hkn`c3=3 zB%i2LiD@A~!*QHo$Q>m{?9FM&A+O;&ZfLj(qB$&~2goz9DGgQJBBxB_C5;M0dZ}lJ zYs;SPTY=MaMKRK*$>?I+X|;S?!)_*{;Z~a= zZyadHet~(ht$00;1RBM|+thQqG^@MypX?|9#Q$8DY_ipAInB21OD>q8N0p_=Mgm2@ zXdb0i1jlGF(PFYEDRP=-Msv*E0edeK3S@_5P(cExBt$^JLZJ`X*hOT;9PB{(h^SI6 zn1grFKOkxrX8VY}W^8-!8!h`7`V3w#>G3`iZ!uQVRq5nQdQv)CN!Q4EgUl{cE2SNz zYunIvkrDoIZK{tEK_~)2$b?EZPHI%rlO$3qCh1owV;B!Hf@c(Mk;V=w93$ieVn2{( b-;w)C7!ID?qilua497Sv3Bm{@%AfrW8(+g6 literal 0 HcmV?d00001 diff --git a/DEV3.2/TP7/Prefixe/Main.java b/DEV3.2/TP7/Prefixe/Main.java new file mode 100644 index 0000000..90e552e --- /dev/null +++ b/DEV3.2/TP7/Prefixe/Main.java @@ -0,0 +1,24 @@ +import java.util.*; + +public class Main { + + protected static ArrayDeque pile; + + public static void main(String[] args) { + Main.pile = new ArrayDeque(args.length); + + for (int i=0; i^)4153|g}7J< zq{@2lp6^bl`}+R)1aO6;3_Xk$4izSX-d0zFNxsorJ*~7`PZy21ZhbB2yV|tNnQqG$ zBT)Ig`;yNBfA4GC2+|wtY;((?v-4*`d{-}N9_7}VdHY%z|D=nG%uugZmO(zGFl14; zzBCWE6SF{Gb{z)TMu+L1nEM!`(#guLQF2+ dA#Xec1MW1CER5lw^*E?>?AjE~2NWZWegKBIIrRVl literal 0 HcmV?d00001 diff --git a/DEV3.2/TP7/Prefixe/Noeud.java b/DEV3.2/TP7/Prefixe/Noeud.java new file mode 100644 index 0000000..b592eb7 --- /dev/null +++ b/DEV3.2/TP7/Prefixe/Noeud.java @@ -0,0 +1,8 @@ +public class Noeud{ + protected String val; + protected Noeud noeudGauche; + protected Noeud noeudDroit; + + protected void afficherNoeud(){ + } +} \ No newline at end of file diff --git a/DEV3.2/TP7/Prefixe/NoeudChiffre.class b/DEV3.2/TP7/Prefixe/NoeudChiffre.class new file mode 100644 index 0000000000000000000000000000000000000000..c91852a425ad8167289a521f59af8851d8901b04 GIT binary patch literal 888 zcmaJ<+iuf95It)*abg^jrj$}Hg+f}Av^4OcM zTe!oJe<4GuUovdg+vj}3TLBNxS{)t9@XT#|U|921PcW3*G88Ats4JpV-VG>H;{Cq# z2O>IABIz-h^)%h?s3h{mu}o9eXII`p_WO}IO5q(8P;zh=_bluqCNYmDc4~3^fpX-lO59lk_Jk&A6{;D~xV&9mtU*#a#gccAU4}y-=!nN>}VQ;CwRoWPK{-1|k+F^^f z7cjtRiHc-x@|xrublT0IV9kT?Fust-aE<{9 literal 0 HcmV?d00001 diff --git a/DEV3.2/TP7/Prefixe/NoeudChiffre.java b/DEV3.2/TP7/Prefixe/NoeudChiffre.java new file mode 100644 index 0000000..2dc29df --- /dev/null +++ b/DEV3.2/TP7/Prefixe/NoeudChiffre.java @@ -0,0 +1,11 @@ +public class NoeudChiffre extends Noeud{ + + public NoeudChiffre(String n){ + this.val = n; + } + + protected void afficherNoeud(){ + System.out.print(val+" "); + } + +} \ No newline at end of file diff --git a/DEV3.2/TP7/Prefixe/NoeudOperation.class b/DEV3.2/TP7/Prefixe/NoeudOperation.class new file mode 100644 index 0000000000000000000000000000000000000000..20743f56bb7159e55a0d1adc84bfc5bceead4f2d GIT binary patch literal 1385 zcmaJ>TTc@~6#k~A-FCZBEElgJDk2nX74H^MD1vAUNKphIbSMKXEW33(CGzf%P#=Ba z(P#t`O^na}BxA%g+Y-wqwwal8&Ya74E;~Q}eEkmKCT4Xs;dB@gw1sg7XLX!IyN2^2 zbm$1+LI|B9bcGPt(5;i!MWve1a7jm!wn;rQtS1u-CLr+0W3_ znOWv*JZW)zF`1LDX)mU_o-)*=oq53!&6u_rE3M86cZ$zhB&p3wo?prG!YyT zaK{``nrHBLDsw&Ol-#@+HkC<(cQsxRE|;cbUs3@LG~<+kJ4k8hHPDBC4R;OP!vI75 zenbqc+rS{wL?mdvrj=x<+v``kJZfMF_ZbZDD!pVbEVx3$uz?XgAkTx2Ba71Ig{+WE z&U`T%#ApZ)4Lm|dL)O5Ua&b~Y8&`e;yIHMqiy?NfR#d4hH*Go!Uark$m69~Ar2<+^K@A!4hdkMI&TfI-W6 zXvwg;g6l;oRw@%qKcB+ zl0bAEHY!!HE7L>$_EOy&gGyOY5ot6$%tNkYN)3~$@-#2)|5|R^YtD+O%wieHFwaZJ zUDxo8YLaoBl@is=7`1KTrY&A93PSg`8ePRlxycW>J#UF(d)Y8`5OI}ckKxpMK^&s~ zyh?w!7geH)i!`^aoGAs(_YA}N1Nj|>jiL4bdh`rL=tEXNADEhV+K&X~xK7R5dAE&(oVcPv(+%P>y^$6kwH1s2cETNns*$aAzPLNg$0y`w~ zYlvtFFyJ?Oh^YI8$S+c>Q6F3-kwGspp!GBA<6q$WiX*@lA^U>bEi};4NQZ*KpkTzj nw2vT4R5KbVR3m|Ep&K7s@q|vDG;^576zN|fK16&Et*d_lf!$Ci literal 0 HcmV?d00001 diff --git a/DEV3.2/TP7/Prefixe/NoeudOperation.java b/DEV3.2/TP7/Prefixe/NoeudOperation.java new file mode 100644 index 0000000..6498c15 --- /dev/null +++ b/DEV3.2/TP7/Prefixe/NoeudOperation.java @@ -0,0 +1,21 @@ +public class NoeudOperation extends Noeud{ + + public NoeudOperation(String ope){ + this.val = ope; + for(int i=0;i<2;i++){ + String prochainNoeud = Main.pile.pop(); + if (prochainNoeud.equals("+")||prochainNoeud.equals("-")||prochainNoeud.equals("x")||prochainNoeud.equals("/")){ + this.noeudGauche = new NoeudOperation(prochainNoeud); + } + else{ + this.noeudGauche = new NoeudChiffre(prochainNoeud); + } + } + } + + protected void afficherNoeud(){ + System.out.print(val+" "); + this.noeudGauche.afficherNoeud(); + this.noeudDroit.afficherNoeud(); + } +} \ No newline at end of file diff --git a/DEV3.2/TP7/Repertoires/Main.class b/DEV3.2/TP7/Repertoires/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..81cbd393d1092848867106411cbac57106724cb8 GIT binary patch literal 319 zcmZutJx{|h5Pj#QaY+I#^xnI(e||r|0Ss}NqJ=$;P6~yt#=b_6kX$+MnrlK-oIMfZoBGufI;HdW zZn>yzcr?|VJMqFePdF}K%9&Z2!QA-iVB7@frU zWlH()N?<&SR*R84*3`HWt-@nxx(%r64E%x literal 0 HcmV?d00001 diff --git a/DEV3.2/TP7/Repertoires/Main.java b/DEV3.2/TP7/Repertoires/Main.java new file mode 100644 index 0000000..6a79a15 --- /dev/null +++ b/DEV3.2/TP7/Repertoires/Main.java @@ -0,0 +1,8 @@ +import java.io.*; +import java.util.*; + +public class Main { + public static void main(String[] args){ + Repertoires main = new Repertoires(args[0]); + } +} \ No newline at end of file diff --git a/DEV3.2/TP7/Repertoires/Noeud.class b/DEV3.2/TP7/Repertoires/Noeud.class new file mode 100644 index 0000000000000000000000000000000000000000..28e63668c2dc85950ed157a171fdbd019bba73a8 GIT binary patch literal 851 zcmZutOK;Oa7@TkYicR|BQ63?sX-aDw+5kl$M8yS(QwWDvy*r6pxr78&3F^;kB`PEi z9CP4DA?DkJLqlX~X8rB#%@aKhIB~LWR}jThSJf^Y471MXkJ;C$Bsj^3+CZ=zC)ce79yeR86>{reF*{>7 z%dBUa4Wom>=&X}ZydtaK)hm{p?c$0rE>J51<{Q*hk3P!y|hVagV80`U`I3&eZ#S>b;YGhZ&iICxnqQC>|H9l79ER5 zql}H(r6sV=kQ!q)Xj{hvY@&iKPPaKtxJtQt%5Mj&RC{nLp2z&VY&5xHl`Oi&T>pZL x$whoSd`7%a*Z-wvR=P(~Wvz39#da8HF{C3A zMjeKAjD(?KNRdlnoWZCfV~V}36h78*C5%RlE9R;q*A)9nJto@dZb~tqDe?6-2;6MI zG-ks19JkcPZAI=Va#xWrbbP5}Rv#lZmMv4I!kTm!%(Xlvn&(O$=PGt3&&rS7a9wkIMm{UaWNbF&$Wk^b(3JMfOm5EH z^bK{)2{fdwb=&kxE**@V>|nB-j^&Kpvhp%HRpYSUeDcJ~Y)Dt2ai9|BZfsFUN+6te zN^V9f8-dn&xhY-Gv0PakR_F|TfO`UlkF?@i$$A7jeA#;_4BW?820lcefr}V0Fpso> z1w0T4`tX$TqJbqmFz^t|N`FOwo?uAYc z+w6GWDtgMKsI+6p@(foS8Cwj)!6xTR^!D}&bQa8}%ST-Y$Bwz}h<{HY;+} ztNVOy9u1^f;CpGWPG^mnd2TADyv@lYoYW{wN-)(o=F7$^cb6+C7sfL+T_u73x3gl| zTTV_^o_M*iw@klFI-aw$vyPK1vHr$g+m`Nh-YgbX)4s2*K*dLSwC|X9mVNCn8zzsJ zrAG3O;llQ&JVCuO8~!4yj^uF{(`G)Owmg~C@twf=WB5+WO`zxh_4v}ya3!n103R_I z1L-+(E98Sbgw4|LKX z*LVm`{EncWQ5w*PFk;-rf>HapwpE-%#!=d8Fh2?9Da%B12irV?ZHSTb|`6j ziOC}g`Q`~NFdmEqquT3N=pBq|k>Hr05xwXWp+q#ai1#0=UMGBOUtjWLyRd&*O4T8h+ZX$9!a_n(X1rhWr=D?8TJ&Rf++=9 z1hw4Tc}5B7BKk4R)UV(Iu9LgX)aTivWfmigLF6!mEsXlmTM+mMAssOyZu<+XbQbpm a48r3XCT5q)MLJHBZ)WI8%0Bh!jsE~?QsaLB literal 0 HcmV?d00001 diff --git a/DEV3.2/TP7/Repertoires/Repertoires.java b/DEV3.2/TP7/Repertoires/Repertoires.java new file mode 100644 index 0000000..54f0a59 --- /dev/null +++ b/DEV3.2/TP7/Repertoires/Repertoires.java @@ -0,0 +1,50 @@ +import java.io.*; +import java.util.*; + +public class Repertoires{ + public Repertoires(String s){ + File f = new File(s); + ArrayDeque a = new ArrayDeque(); + a.add(f); + Noeud n=this.tree(a); + this.afficher(n,0); + } + public Noeud tree(ArrayDeque a){ + File f = a.remove(); + if(f.isFile()){ + Noeud n = new Noeud(f); + return n; + } + if(f.isDirectory()){ + Noeud n = new Noeud(f); + File[] liste = f.listFiles(); + for(int i=0;i);;l zbCevEvFO0U109xhsBkQEtT1F>sz{|f42EBQ!(hIOk0e9BsUo>I>bGTbAle~y%)U?& z!-D^=*%R+YJrq&5-bxb{b++JD_5`E zJ=saGwOSu&YM&;>Bibll96`nPee$2uDWvFcF%+gVuD2QZK!ZZkDEc>_J%6R$2xCDC z&OjtXdAYce)*$D8L*JY$dgMwbd$AlHG1zH*ajgvVe)WGrEJHuC{xTpoJc_qywMdy! zwt_RTFI3PoQp`@9^ahy4ZK^f&6HFMCcY?_YX1*dbXN+NfhxIlvHoqZz2HrHb%faLn zg<4S7tugG68TR?_PeRwm$Pr#^WTqM`u&Flbzp}`VjS^X0C6nuvpONA=q2>tT!SH?~ P&tb7&D3Y1Nbj18W-wc({ literal 0 HcmV?d00001 diff --git a/DEV3.2/TP8/Tri/Main.java b/DEV3.2/TP8/Tri/Main.java new file mode 100644 index 0000000..6af9158 --- /dev/null +++ b/DEV3.2/TP8/Tri/Main.java @@ -0,0 +1,16 @@ +public class Main{ + + public static void main(String[] args) { + if (args.length==0){ + System.out.println("Usage: java Main listereels"); + } + + Tri arbre = new Tri(Float.parseFloat(args[0])); + + for(int i=0;i!v%VfqX&r>4PFQyG$bAu+Gq*3388#14}?S$KY$;~ z__m08GMmio&b;@VosZAgcL3)&QE;$ZKo(6C_DtA!aG;nE9UKX)rJf0-FDOQFkoY$` znLGsoXD~F+3xP`O*Yh}B2y(qJ3Ky3GyWQ`Mn66@<>dGLDf?@JJ4(9iIJY%J-eLp2^ zfu(KXo22gIWIhS{p;4<;dN$Qd?V^NZ7kLz1C=^||CNl4sl~htElCoS{eydm8F(t`n4>C5)mwG_*}zHfw(I>mTd}XtqsQ< zbn7&&TDIk_3&bkT#c%m(I9&!zv>3NBc)e}9TXMTci!OJafoHmYqQLm3Cp&v>xgWaI zm1bB|RY`cxrsrDrD}kxXVry3($fcgNUo8dJx`tZ<`N}Y3G(aG==?vVC*|gN=i7nT< zs;cOi!fk;upF%BiILrwrX@+b(LyXQDw-*e@D+w^vv zZhs<<^#s1u@fGeSa4&&|Qtt~yxg+CG$e(TRnjP;W)3C*8MfDs#kUas>6iC}@xDVx^ zvqScb>~?+Jp&{kF@4Jr0a^pj<;RQ%d+3_6rjfOVwP|I=l2K&4t zk8Rs@8$H?Yo8G0qQ1#Qjg(VuY z*W0u_lh=ju9Q^Z=8_dkEuqL|zo% zBl;U+zxqiRC^LvsjxjLKVj2^tkJEpkPo;ljyhZFS#)?1wjB=pI|3pS<#dpvSv1}AW z^E)ICQ3@8xlbF;YCWbLd#;E-xQ2Q?+L7Cz!NfTLTOB1-pR_?Hk2aNa{Gx(Gdam3~` zQ)!=XCT#C}@+tbYS_oI5Lb7x%z$zO>W$>Bu)ClCeNTd6%vrsM~i2_G4%Rwxlgv+R+ zjAa;n(^rNl)9Flt5P5tSqI?&QYAu^?g`@a@oN+uAy?TUkAoL~atA{lIM6gQZ*OqiQk#4Y|{R(u5hcK^n#hKqThq7YK_!-1?+Iglex5^ZYn56Bwo z%bjXIhO&|&TT|v^fOhS_0INKhHQumw%<*BCahC{<6M#7af){ + if(this.racine.noeudGauche==null){ + this.racine.addNoeudGauche(f); + } + else{ + this.ajouterNoeud(f,this.racine.noeudGauche); + } + } + else{ + if(this.racine.noeudDroit==null){ + this.racine.addNoeudDroit(f); + } + else{ + this.ajouterNoeud(f,this.racine.noeudDroit); + } + } + } + + public void ajouterNoeud(float f, Noeud n){ + if(n.val>f){ + if(n.noeudGauche==null){ + n.addNoeudGauche(f); + } + else{ + this.ajouterNoeud(f,n.noeudGauche); + } + } + else{ + if(n.noeudDroit==null){ + n.addNoeudDroit(f); + } + else{ + this.ajouterNoeud(f,n.noeudDroit); + } + } + } + + @Override + public String toString(){ + String retour = ""; + if(this.racine.noeudGauche!=null){ + retour = toString(this.racine.noeudGauche) + retour; + } + if(this.racine.noeudDroit!=null){ + retour = retour + " " + toString(this.racine.noeudDroit); + } + return retour; + } + + public String toString(Noeud n){ + String retour = " "+n.val; + if(n.noeudGauche!=null){ + retour = toString(n.noeudGauche) + retour; + } + if(n.noeudDroit!=null){ + retour = retour + " " + toString(n.noeudDroit); + } + return retour; + } +} \ No newline at end of file