From 9dcc0c40830168039d43aadcc5faf4e09ebd90a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=91=BB=E5=BF=95=E6=86=B8=E9=90=93=3F?= <1394157072@qq.com> Date: Tue, 3 Nov 2020 23:14:41 +0800 Subject: [PATCH 1/2] AutoPush --- ...6\347\275\256\350\264\246\345\217\267.bat" | 2 + ...7\346\215\242\345\210\206\346\224\257.bat" | 2 + ...2\345\212\250\346\217\220\344\272\244.bat" | 3 + LinkedList.class | Bin 0 -> 1226 bytes Main.class | Bin 0 -> 485 bytes Node.class | Bin 0 -> 424 bytes syh/1212.java | 189 ++++++++++++++++++ syh/LinkedList.class | Bin 0 -> 1308 bytes syh/MainTest.class | Bin 0 -> 510 bytes syh/MainTest.java | 8 + syh/Node.class | Bin 0 -> 357 bytes 11 files changed, 204 insertions(+) create mode 100644 "1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" create mode 100644 "2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" create mode 100644 "3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" create mode 100644 LinkedList.class create mode 100644 Main.class create mode 100644 Node.class create mode 100644 syh/1212.java create mode 100644 syh/LinkedList.class create mode 100644 syh/MainTest.class create mode 100644 syh/MainTest.java create mode 100644 syh/Node.class diff --git "a/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" "b/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" new file mode 100644 index 0000000..ac7e603 --- /dev/null +++ "b/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" @@ -0,0 +1,2 @@ +git config --global user.name "苏瑜煌" +git config --global user.email "1394157072@qq.com" \ No newline at end of file diff --git "a/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" "b/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" new file mode 100644 index 0000000..1ec69c4 --- /dev/null +++ "b/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" @@ -0,0 +1,2 @@ +git branck 39 +git checkout 39 \ No newline at end of file diff --git "a/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" "b/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" new file mode 100644 index 0000000..0fbd52f --- /dev/null +++ "b/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" @@ -0,0 +1,3 @@ +git add . +git commit -m "AutoPush" +git push \ No newline at end of file diff --git a/LinkedList.class b/LinkedList.class new file mode 100644 index 0000000000000000000000000000000000000000..6ef66110d88697e6bd9c60ade2a9b27f636862de GIT binary patch literal 1226 zcmaJ>TTc^V5Ix&&yWQT-q(Af_S4?6#`GC8cR%gT<8WD%C=dyL|^+1o^dPmL!Dpg-XfF@~~(-wwIF-Oe9~? zy-c%&*1YXlh1%Yx<*u8XWm+_|R9dgBx)sNh(3QyVmc4qV|q209O1Tp{+^R=mw)5>kX^A6G@ zY!qf!GA~5^RAHHWd=J_7LGhdF4x81gZV^oN5UH@j^VwJoCZ0cJpS?E^*h46G(=1jKF&z z-NQA;5f^wFA*cuw*NZ;lMcfX3GWXOef*Yw5$ZN(C0$&g{rpa-LE^#gR7ja4-BP56e z5X8g$r+}0yqLinTHijXzVvIL~GW&gR;0(PA2HG*`2M#g+@J0T2zw^)iBmbbEKYfJI zXGFzTI6VKJrnXBm#tEkIfG0=u^+6wscGb* zmj~1oAU-Q{=Tm;}sSgOBLfJS$ga)+^Egr2yucM`on1JLD&%Y7VaJDvk)X#>4QbL$u fhbH;ync`O^i3N7(qCX+Z5ii(KGfKUp#bdt!CldI9 literal 0 HcmV?d00001 diff --git a/Main.class b/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..409939c34c612a3841273627b83d7748904a1807 GIT binary patch literal 485 zcmYjNO;5r=5Pe(PuGA_Y3L=W4(F7!si#LoH6B3dtQHY80w9u6lp*6Mezr29a#2?^~ zGR{^K*kosBXWqPdvp>I|-vBOfY$1s($Cd>RSqt09sVJ|^jxq&~U5+AydFlCHbj6UU zR38}h>%f%^DaZ5W?PT1OVOR7&mS~Yqtyu}VP7^q z1y0@&_*~&^SXiej@x4gb@!leiJsbNd**L(Vjj}RF3ZttghV+uY-5bh&#E@C0T7D!4 zGGyRWF`CHsvy#-Ru4q~y8Z=b6ZZ~L#flnN{$_nP6IM$tvLHAM+r}0YbL?mgAeoq~Z zF6jq@O;L$FBX69|!QLrg*dS}hNm?44NKveychstyPrsl&&XI6x`UmtGjGD3VX6(({ d417sdBr+gD^L32k@bc z-?oVdIqdAr?0mo3neU&^F93JA^w2`rg@qGsP92;%I2W)~EtdjeHqT%4{vt1D{pVsX zr}cw?J5sYUuh*3nFvkOCtWv(!0(LfBy-3FGt&{LAWn?F+RCOxQjheXLgz`tq1cFSJ za=2a=vKr^bf*Cs^LRUn|;J&F%n<)Wrv|3kF`J^&x_zrzY;m!+j#2N#~zrtKj0{{R3 literal 0 HcmV?d00001 diff --git a/syh/1212.java b/syh/1212.java new file mode 100644 index 0000000..c32a793 --- /dev/null +++ b/syh/1212.java @@ -0,0 +1,189 @@ +public class LinkedList { + + Node first; + Node last; + int size = 0; + + + public LinkedList() { + + } + + public LinkedList(String s) { + Node newNode = new Node(null, null, s); + first = newNode; + last = newNode; + size++; + } + + + public void add(String s) { + Node newNode = new Node(null, null, s); + if (size == 0) { + first = newNode; + last = newNode; + } else if (size == 1) { + last = newNode; + first.next = last; + last.perv = first; + } else {//其余情况 + Node temp = last; + last = newNode; + temp.next = last; + last.perv = temp; + } + size++; + } + + public void firstAdd(String s) { + Node newNode = new Node(null, null, s); + newNode.next = first; + first.perv = newNode; + first = newNode; + size++; + } + + public void lastAdd(String s) { + Node newNode = new Node(null, null, s); + newNode.perv = last; + last.next = newNode; + last = newNode; + size++; + } + +/* + public void insert(String s, int index) { + if (index == 1) { + firstAdd(s); + } else if (index == size) { + lastAdd(s); + } else { + Node newNode = new Node(null, null, s); + Node node = jump(index); + newNode.perv = node.perv; + newNode.next = node; + node.perv.next = newNode; + node.perv = newNode; + size++; + } + } + + public void delete(int position) { + Node node = jump(position); + node.perv.next = node.next; + node.next.perv = node.perv; + size--; + } + + public boolean findItem(String s) { + Node node = first; + for (int i = 1; i < size; i++) { + if (node.s.equals(s)) { + return true; + } else { + node = node.next; + } + } + return false; + } + + + public void copy(LinkedList linkedList) { + LinkedList list = new LinkedList(); + Node nowNode = linkedList.first; + for (int i = 1; i < linkedList.size; i++) { + list.add(nowNode.s); + } + clone(list); + } + + + public void clone(LinkedList linkedList) { + last.next = linkedList.first; + linkedList.first.perv = last; + last = linkedList.last; + size+=linkedList.size; + } + + + public Node jump(int position) { + if (position <= size && position > 0) { + Node node = first; + for (int i = 1; i < position; i++) { + node = node.next; + } + return node; + } else { + System.out.println("error..."); + } + return null; + } + + public Node find() { + if (size == 1) { + System.out.println("没有中间节点"); + } else if (size == 0) { + System.out.println("链表为空"); + } else { + if (size % 2 == 0) { + System.out.println("没有中间节点"); + } else { + return jump((size / 2) + 1); + } + } + return null; + } + + public void fz() { + LinkedList list = new LinkedList(); + for (int i = size; i >= 1; i--) { + list.add(jump(i).s); + } + first = list.first; + last = list.last; + } + + public int getSize() { + return size; + } +*/ + + + @Override + public String toString() { + Node node = first; + System.out.print("{"); + for (int i = 1; i <= size; i++) { + System.out.print(node.s); + System.out.print(", "); + node = node.next; + } + //System.out.print("}"); + return "}"; + } + + /* + static class Node { + private Node perv; + private Node next; + private String s; + + public Node(Node perv, Node next, String s) { + this.perv = perv; + this.next = next; + this.s = s; + } + } +*/ +} +class Node{ + Node perv; + Node next; + String s; + + public Node(Node perv, Node next, String s) { + this.perv = perv; + this.next = next; + this.s = s; + } +} diff --git a/syh/LinkedList.class b/syh/LinkedList.class new file mode 100644 index 0000000000000000000000000000000000000000..a02a97b5689852c73e48cc62add84940a201ee53 GIT binary patch literal 1308 zcmah{Sx*yD6#j0vnU*Q71w@dgY|;(NQbk!@LNw77FsYI7qyrtvu(YHt#3j7>D{zfI z@T!JNqKS___#^xw#_hW^m9|0S!<>81IrpA#nfvAEhfe@fxa>m^{ayqxpx}%TP7KN< zB16>6G$upbiv)&L4EvD8h^&mN7*jE>Af@1}fcu_VD3$~~>G^!tm=bVp=rVT|&4-47 zxX#wJnKMfl1)P!SZFXjPP#};tbH@Dk=CV<^r7v%=(h^Cp={tIIL(i=yGo^x=Tb+^@ zoO(7Z;LnuwmGwD&%Q{WU0;+|5MRpa5YVFig-o7i)9El#EDB#QFw+k!AHB*908tX$uJ?qd4v>P&@c%~7LOE6YnVa1hKsl);7Ej7 z-6d3Yx z9Im@{W4oa6qE;E}=Pzp{TmW4p9wBLg)A$4PnJ_M%UaOtXk$VVMLH02llQ1vQV}l+L z{Q#aa6uIzom!a;XQ)ctlk)fLY5S#Tp9hUq_@&YYupj{yv)=I;=*%>6e1UXKi16RrV z2CEAQW0B_HK_5)?vqMYa{Elt~oda#u)ODn3v0`1kMpMEjDfznTn`(>ui+Sz*e;|bh zTGfOoX~YN}XG{>J`@bMGMU~nKqS$8r6C_EH5rT{oWQ-u=1W6GjOr7@Q+2!Mrk6=R5 zPQQaU_>*Gva<$7_UHi61~?P4@g;nJVeW4zd61YpC%Jui94kLgjvs#yo)^Pigft ff;^|b7Z_%q!Yj*C4UQiO&{FY@CJXdh6Z(Dww;$pz literal 0 HcmV?d00001 diff --git a/syh/MainTest.class b/syh/MainTest.class new file mode 100644 index 0000000000000000000000000000000000000000..20c8b32bfc8309cdb8d7fd8a5f542fa232a8c409 GIT binary patch literal 510 zcmZutSxW+86g_tqzi}GV+*-7K!4mSNHzR1Fr)dEth@M90L&kI_bPW1g^`KDD59mil zca$)pdAR3(mvhcNcfP*gKLH$J&xDDLK-PqUjDcK)c>{}aEMeKi3JL;6fmK56*z>*c zgrJu8?+Ds?;7UT$_I!Cg=r&}p?ld|)(YlW36Y`}8yX`zXm5$@LDz&iZ`K@XsG;6`2 z*OZrDL{3~Wxi0(RVZ^mC2a6f(`6yl6>xTq7wXlYDZq5WYENo&+VB5kDb_vF>oRFF> zyJ@s#lclQTx`bTm{~Uh=wU>SEXz&!UQoH^&>=^cPPaX3)dTond1cGQt&&jJK{E%01H`Uf32WP1Pr literal 0 HcmV?d00001 diff --git a/syh/MainTest.java b/syh/MainTest.java new file mode 100644 index 0000000..2eb2211 --- /dev/null +++ b/syh/MainTest.java @@ -0,0 +1,8 @@ +public class MainTest { + public static void main(String[] args) { + LinkedList ll = new LinkedList(); + ll.add("A"); + ll.add("B"); + System.out.println(ll); + } +} \ No newline at end of file diff --git a/syh/Node.class b/syh/Node.class new file mode 100644 index 0000000000000000000000000000000000000000..eec565844b8bbf1e412e75d3d1b764dbf09bc58f GIT binary patch literal 357 zcmZXP%}&BV6ot>UwS`&*0a16lgQBu=Ct+jas=)<@eG3yZh=VDG_*yO+6^swyLlMuQ zi3=BVZtlJz{fPJFni6tRPC{X_U=q{PaA$PSK%>hn%l*@B%K02u| z=53^(kw+1{N8M-Efdz-L7QRA+tsGW(p2H3=ayT#B=@PY0D)7e1chXjLu2IDY8D-Wj G9DD Date: Wed, 18 Nov 2020 08:02:08 +0800 Subject: [PATCH 2/2] AutoPush --- base/base/work1/MainTest.class | Bin 0 -> 442 bytes base/base/work1/MainTest.java | 20 ++++++++ base/base/work1/MyStack.class | Bin 0 -> 1430 bytes base/base/work1/MyStack.java | 54 ++++++++++++++++++++ base/base/work2/LLStack.class | Bin 0 -> 1760 bytes base/base/work2/LLStack.java | 86 ++++++++++++++++++++++++++++++++ base/base/work2/MainTest.class | Bin 0 -> 469 bytes base/base/work2/MainTest.java | 24 +++++++++ base/base/work2/StackNode.class | Bin 0 -> 337 bytes base/base/work3/Main.class | Bin 0 -> 435 bytes base/base/work3/Main.java | 14 ++++++ base/base/work3/MyQueue.class | Bin 0 -> 1497 bytes base/base/work3/MyQueue.java | 55 ++++++++++++++++++++ base/base/work4/LLQueue.class | Bin 0 -> 1615 bytes base/base/work4/LLQueue.java | 82 ++++++++++++++++++++++++++++++ base/base/work4/Main.class | Bin 0 -> 444 bytes base/base/work4/Main.java | 17 +++++++ base/base/work4/MyNode.class | Bin 0 -> 312 bytes base/work1/MainTest.class | Bin 0 -> 442 bytes base/work1/MainTest.java | 20 ++++++++ base/work1/MyStack.class | Bin 0 -> 1430 bytes base/work1/MyStack.java | 54 ++++++++++++++++++++ base/work2/LLStack.class | Bin 0 -> 1760 bytes base/work2/LLStack.java | 86 ++++++++++++++++++++++++++++++++ base/work2/MainTest.class | Bin 0 -> 469 bytes base/work2/MainTest.java | 24 +++++++++ base/work2/StackNode.class | Bin 0 -> 337 bytes base/work3/Main.class | Bin 0 -> 435 bytes base/work3/Main.java | 14 ++++++ base/work3/MyQueue.class | Bin 0 -> 1497 bytes base/work3/MyQueue.java | 55 ++++++++++++++++++++ base/work4/LLQueue.class | Bin 0 -> 1615 bytes base/work4/LLQueue.java | 82 ++++++++++++++++++++++++++++++ base/work4/Main.class | Bin 0 -> 444 bytes base/work4/Main.java | 17 +++++++ base/work4/MyNode.class | Bin 0 -> 312 bytes 36 files changed, 704 insertions(+) create mode 100644 base/base/work1/MainTest.class create mode 100644 base/base/work1/MainTest.java create mode 100644 base/base/work1/MyStack.class create mode 100644 base/base/work1/MyStack.java create mode 100644 base/base/work2/LLStack.class create mode 100644 base/base/work2/LLStack.java create mode 100644 base/base/work2/MainTest.class create mode 100644 base/base/work2/MainTest.java create mode 100644 base/base/work2/StackNode.class create mode 100644 base/base/work3/Main.class create mode 100644 base/base/work3/Main.java create mode 100644 base/base/work3/MyQueue.class create mode 100644 base/base/work3/MyQueue.java create mode 100644 base/base/work4/LLQueue.class create mode 100644 base/base/work4/LLQueue.java create mode 100644 base/base/work4/Main.class create mode 100644 base/base/work4/Main.java create mode 100644 base/base/work4/MyNode.class create mode 100644 base/work1/MainTest.class create mode 100644 base/work1/MainTest.java create mode 100644 base/work1/MyStack.class create mode 100644 base/work1/MyStack.java create mode 100644 base/work2/LLStack.class create mode 100644 base/work2/LLStack.java create mode 100644 base/work2/MainTest.class create mode 100644 base/work2/MainTest.java create mode 100644 base/work2/StackNode.class create mode 100644 base/work3/Main.class create mode 100644 base/work3/Main.java create mode 100644 base/work3/MyQueue.class create mode 100644 base/work3/MyQueue.java create mode 100644 base/work4/LLQueue.class create mode 100644 base/work4/LLQueue.java create mode 100644 base/work4/Main.class create mode 100644 base/work4/Main.java create mode 100644 base/work4/MyNode.class diff --git a/base/base/work1/MainTest.class b/base/base/work1/MainTest.class new file mode 100644 index 0000000000000000000000000000000000000000..81172e28b9c456dd1bd78a3fc85a43a1b90b35ed GIT binary patch literal 442 zcmYL^+e*Vg5QhIvlctTSO^+UGgL8qCZdn!O$!P> zfDa|kEJ_3W?auDZe3S2=k1qhnXd1|&q@!#=L4{Fe)EIRg8#*=xvgdx_Cl>-4d;d;A zy$l~cfnv`Oyqk13^x}a#oYIXtbNxV|Za?%U?u*-0b*aYxS_ZkgC-G+>z6;n&=MiGZ~d+zuz+C?UIjEvJjp`4hP! z(k8MQ%^igiTF~iV`BNZRM_i+*NxPt3J6J-z(?P%_X5}R(7O+ldPJKm&ihU2has7=F&|uroWIw%aW&)P+J(V7u5|Dj$L^Sc(*@MNHP1P-5b=JHe^@G1<-< z>zxS^z3_?{zix^*#AqU*U1DkY0bcqWY~jv(W5nm3nSLl}vU$(WIq!MC-r4=-ujTsy zj$+C}4-TcU9nVS`l2Wi(iYXk%u!-j^9Kli9IcDOxf#)r>;gFOQCQi!wf|L;xqb5$7 zIBnoX17iwFrxZA|?<#1QCl!pU^M1+uz*SIuN(6PE9iv{&3r;KOxyivdxty(++0Z%V z)!f&b)fu<(hBH&)j^WLptNOtLFXjfP71~4O3yvS3C%yTJW~D*|zd8R7yL^FXuYmfl zOA&k^ujMzqS`h29O7&)A)}8Q#!oIK&ZWrd9_Z%Bp?6>h0`fTi!(u*B7_F=DqGd9L? zmLk^{KVG|ckgV<$RezzjcaP#YPm;n{*dv=G@ufA6un``M|9*n0k{3JyT(`S1-OECDd@8>WD)3 z6Sm0_##pKGUM{-0#ngzTo^*WQt(6saakP)M#J-6?^rZX$({Bd#C_07hxyOM=Fu)hJ zhi`TQnoNz~G#O#Ia-LibD2{g*>ux@s;km}OFMk&*uPs5#XP1!3=YK+C#ae=Xn}?hN zYcIC38qm3>V4{O{CoGXz%>a$O|o<^RIyTF2-LF`nLVRH8s}v@hSnwl87dK{8{sVBRL4p1(w3{q1S` z%w800k*vsC56$(Wlc}Yd)BxXqkx4~qih2h7W07-VguqD>q+$X~2*`8~ZI|xC-k_S+ z%cLr_(4OgNp|gdwH2#ZsHv#*}yNA33IKe!&@E*Xyn0GwRwlCss6Jx>~lF?RSGv*Ge z1`ZJSAaMuR@j8i=+wgHM4(j|CA6;=!+GzG`9NsjP$xwY(Y;^OBFlNP6=0 ;i-- ){ + //System.out.printf("aStack[%d]=%d",i,aStack[i]); + System.out.println("aStack["+i+"]="+aStack[i]); + } + } +} \ No newline at end of file diff --git a/base/base/work2/LLStack.class b/base/base/work2/LLStack.class new file mode 100644 index 0000000000000000000000000000000000000000..7364d2742be2649659f494d1dfe81ac8dcb81896 GIT binary patch literal 1760 zcmaJ?>rdNN7=BJ$`fJONQA^oii~;Hd3LD7SMGK6}VBiX47Ez`jEbz@CnP%*15I z8-CbgvMjr(2{SQ^m&Bn^CXjvfgMWshFh4Evvr(V-*HRj{nY8DezURF>&-=Uwe*1g% z0f2VAd1>L<{%9h3iT;Vy>^tN}&xByn6EophGLS{2;0nf5GgHPuSaRz* z^Pvl&iy&D0aRjm?XgSy{T|y+L%!&-~94& z=JTr?_b+eU|1R_Khg(YvkJfMN7{}{6-VjLRm|($&Uw@xj|0VP3s*ZDblZL#n!hRN$ zsy7xkf4;u?*|p4-dk-I6qwjY4@{P5tbok>=Ix~Ndhs^4Avq%v23YOZ76e`~__YTxE zlNXFBDp_C(UYboBQ8qiC;zfDDbPmT`My2bdW`v>~fwCu9;&4?ILLxyi3$LN0?9m#lB2L*4#3lGP>Vb$yuj7PFu)F5&b>b8-a)(Ec*WhPmSOQ( zmtpl)EyK1Gy&FaJaWYz7VKJYhjxv-m2gfv*shxSG@H4(8#xKFP0L^w6HtP>GT1*gj z)4>fNEk&@Db_-MvELVZv%3U&)NQSST67AiNF76iZW^6P0f-RCJ4f@h3x&{3w*gaYr zj>R=NC#qK98s5G+sGEEVCO1PioI}Cl1hqF zOF<4$k`|s?`D%|-hE57`idLcMgvI?AYBU@q&_j8J{v=Fk`OPdI6KIJ57253DF(O~X zu89?tdfaKVpOz(f(kSzI`7@1jI%lOaNlXg~A-RIxfr8jQPmLwtfKOO2L1!xxc}7NE2*q zf}i|b^8CLcd*Oe!fPaPX7sV=h*ybV#15L#EE2??N6PvJCysGFW7lFI~{JwJ|^IE8w xpTIi^ypzCB5O_Cr>Y+Bhq|ry1C((s|3{bC844PnFuu?HE6{{uWRx{s={{okzdtU$m literal 0 HcmV?d00001 diff --git a/base/base/work2/LLStack.java b/base/base/work2/LLStack.java new file mode 100644 index 0000000..3533004 --- /dev/null +++ b/base/base/work2/LLStack.java @@ -0,0 +1,86 @@ +public class LLStack{ + StackNode top; + private int count; + private int maxSize; + + public LLStack(){ + } + + public LLStack(int size){ //ջɵĴС + top = null; + count = 0; + maxSize = size; + } + + public boolean isFull(){ + return count == maxSize; + } + + public boolean isEmpty(){ + return count <=0 ; + } + + public void push(int value){ + if(isFull()){ + System.out.println("ջˣ"); + return; + } + StackNode node = new StackNode(value); + if(isEmpty()){ + top = node; + count++; + return; + } + node.next = top; + top = node; + count++; + } + + public void pop(){ + if(isEmpty()){ + System.out.println("ջǿյģ"); + return; + } + if(count==1){ + System.out.println("һԪأ"+top.element+""); + top = null; + count--; + return; + } + StackNode temp = new StackNode(); + System.out.println("Ԫأ"+top.element+""); + temp = top; + top = top.next; + temp.next = null; + count--; + } + + public void printLLStack(){ + if(isEmpty()){ + System.out.println("ջ޷ӡ"); + return; + } + System.out.println("ջջף"); + StackNode temp = new StackNode(); + temp = top; + while(temp.next != null){ + System.out.println(temp.element); + System.out.println(" v"); + temp = temp.next; + } + System.out.println(temp.element); + } + + +} +class StackNode{ + int element; + StackNode next; + + public StackNode(int n){ + element = n; + next = null; + } + public StackNode(){ + } +} diff --git a/base/base/work2/MainTest.class b/base/base/work2/MainTest.class new file mode 100644 index 0000000000000000000000000000000000000000..9bdd46c24fb56a415e5495e2076bb6f7dd6d59ad GIT binary patch literal 469 zcmZvZ%SyvQ7=_QIm$YMQ)4P{e&{eczMO=s$5xjs9b zfDa{}35pvB=9`&+&YyF_e15%s0N6)OB88leyo82=LQ$clP}Wh=u_TaedcGGP3&gC= zTY>oL=)o1p+Me%TPlp|M+;%zxR^mg)^99P*z1?@7oyNfNdyQ5&_Wa(FYLu zJSEOtQQUSX;f~T8NJ9$fw%rPy?vpw$8(2|Tg)~rAx2fM20rSt`rqg%3A>FOZC|xj} zJPH^AZNs0>F?lcwunwJntA+-l49NwaYFq`^#MT_*l^eE`$*8D=87y+Iq%VlE890B3 zc4x{tVs_n>GsNp=G2&W8E8?Ew3<=KUKQr-Xbw~sHGf^5QS*BT)AvS1j@ot;dUF7&+ Vc^sgCCW<&g31_Gv}cx1DCSDxSyl zM}0164NFtj7o7G+Cl4%_RA~my1GQm6i(ApQzKRdQl+) zL?K%6LTteo_|w{02}*Sz-aJ4%Q?LtSb~0HWZ2uHXUpU0aai;}8ZN-p5d8{fD4VJBt9ztyRd?Cq5v3GGtd zh^DJ*!fQKVss2@jajr|B^(C)Cs#=8O^epJ{Bs F`vV+4L^l8c literal 0 HcmV?d00001 diff --git a/base/base/work3/Main.java b/base/base/work3/Main.java new file mode 100644 index 0000000..e6f0ae0 --- /dev/null +++ b/base/base/work3/Main.java @@ -0,0 +1,14 @@ +public class Main{ + public static void main(String args[]){ + MyQueue queue = new MyQueue(10); + queue.push(10); + queue.push(20); + queue.push(30); + queue.push(40); + queue.push(50); + queue.printQueue(); + queue.pop(); + queue.pop(); + queue.printQueue(); + } +} \ No newline at end of file diff --git a/base/base/work3/MyQueue.class b/base/base/work3/MyQueue.class new file mode 100644 index 0000000000000000000000000000000000000000..da9377e22e1b1ec47e45a3c08b3f2543104ea53a GIT binary patch literal 1497 zcmaJ>&r@4f6#njeFL}x1Q6iH?Ajlj;<#WsB?9t**Lv9Pv9hA;oERk~t^$+;hJ3edpZCuYa#^ z0XTta2d(IhVjud%^otn~bJU?Z7RAdr9>EC*Cvi$5gAtszamIm*UNJ)v42vHT^GXC~ zCG*t?Ms1w4ab6)bmn&t93Ti^Zy5@Unx}q0k6ilyBP%z%*MR+902F0_CCA;5Y!i8Mg zS7@3Hvi{}L!mM9-+ndcWVkIZ!J{&BLmofs8?7phdI8*fIKAiIMwJbYW99zg2mzbX~ zEnZ_9zbLHl(hie;^FPAHy-FURR z{9yg&a2MTSy&f;0_p@Ad8`t$zN=*^*`<_+*Klzbjt~wNj zmgLjGL=0(e=-@+b<@2^+$kzDFkUeV8Rcg=W(%T#wcTM{OPaX7}BSNV)sJr~3kf3!~ zE~yqGjI`@CNx#Ur+{7h472kC3!$_I;VT!TDgr0yLL|8*vXyC_142@*Dhfk}CpnO)e z0(z2=!l5~}N*=2)ww7UAE3nKT88tMau+C_~ON@kI#72cSpA)S>9HkeCMuGV5KdKMx zR5y%Dc4u9cCy=b}O_dS;7VbUR&5<&qcT-mgXT48VLQ788RXJMmX^~l_R+ZVtX|+?> zA<9fpVh4ICQRtdbF}CZf&-@p?C19TIoLajE-EI};2%B%fy|SjY80>5Im$9e0sf<_| z&oQk^DlMesR+w#B>18-_TH!sNkkmJEa~IQ2M9Jp}nRb$C7nyc*Aw4*SUW}p-@1Y+b z@E=lGCt$|5F$Tj%lGCEymMQ5|Eyn7dXY^4`(vUe4uMzqIUH_I6*E*VabnN|9sg>>D pWY#SrzCO=Z_5lX@SWc7MAdX=OXE3Z;MPd8}L;Xpj3MpOE^AEnsCcOXv literal 0 HcmV?d00001 diff --git a/base/base/work3/MyQueue.java b/base/base/work3/MyQueue.java new file mode 100644 index 0000000..2124f4a --- /dev/null +++ b/base/base/work3/MyQueue.java @@ -0,0 +1,55 @@ +public class MyQueue{ + private int count; + private int head; + private int tail; + private int[] arr; + + public MyQueue(){ + } + + public MyQueue(int size){ + arr = new int[size]; + head = 0; + tail = 0; + count = 0; + } + + //---------------------------------------------- + + public boolean isFull(){ + return count == arr.length; + } + + public boolean isEmpty(){ + return count == 0; + } + + public void push(int value){ + if(isFull()){ + System.out.println("Ԫˣ"); + return; + } + count++; + arr[tail++] = value; + } + + public void pop(){ + if(isEmpty()){ + System.out.println("ѿ"); + return; + } + int temp = head; + + System.out.println(arr[head]+""); + count--; + head = (head == arr.length - 1 ? head : head+1); + arr[temp]=0; + } + + public void printQueue(){ + for(int i = 0;i <= arr.length-1 ;i++){ + System.out.print(arr[i]+" "); + } + System.out.println(""); + } +} \ No newline at end of file diff --git a/base/base/work4/LLQueue.class b/base/base/work4/LLQueue.class new file mode 100644 index 0000000000000000000000000000000000000000..82de29bcff8c59b3b680e03e1a79c36186925349 GIT binary patch literal 1615 zcmaKrUvCs;6vm%-cXnrYI%SuZLQ7FVDP5*rwm@6J{&8t-wJ=+Xi)g)a+D>3_|D~NZ z)H@R|y!S%n22G5_#Kb__Z9TaEKMzLC7Uv=j_(Kegz zlQ*4D91}Y!sOE$L+h1zWD0V&V$Fh-|AR2aT!Yl z49gak0TWjw_XGyp!=L={P@zA}eti2UZlB!w{Li01YyBx45RhESsa($$eR5x)se7e0 zciqIh!coLkmX*y;%j>pbYO zgJ7?kTar%kyRK7a`?_D^<~M?NmMYB4go$mm6Tu`a?k&pdZpkgXGWWPstGN|kjYAye z3pvdS`N8bV1pg;K;a9^ZDeTL<+ydIy zxjV{LagA9!Q1|(waE#VKgjT0qf*y{WR>J4#my-_Wq~Y9eIhiS|xplC?B9;H4y(A<^$+mi3XDQcVR5|@1Ua)%Jy2r zQYnpQE%QU#M^Y}&G`h^^{S*w@$5}Qw8l7WFaUf~_-1<0(BYXzfS&O3>Wf^1KO|dOA zEXyXV)S5&j{TGhu7$Wg-Yi4)JD?zfWAj>+gJkFwI*!Twj^o`CW}#a zSV?gB9Pto|he@0zagOXGNxoc?Wyx=xU(5YhMFB4eW2=fP~oh{`s9T;bE`bv9P(v*&<+)s8d9p hCTbo%xWG0G)GT*%xQO`x%|MjR)YwdmfF}cu+`m9TGvxpP literal 0 HcmV?d00001 diff --git a/base/base/work4/LLQueue.java b/base/base/work4/LLQueue.java new file mode 100644 index 0000000..e7625be --- /dev/null +++ b/base/base/work4/LLQueue.java @@ -0,0 +1,82 @@ +public class LLQueue{ + MyNode head; + MyNode tail; + int count; + int maxSize; + + public LLQueue(){ + } + + public LLQueue(int size){ + maxSize = size; + head = null; + tail = null; + count = 0; + } + + public boolean isFull(){ + return count == maxSize; + } + + public boolean isEmpty(){ + return count == 0; + } + + public void push(int value){ + if(isFull()){ + System.out.println(""); + return; + } + MyNode node = new MyNode(value); + if(count == 0){ + head = node; + tail = node; + count++; + return; + } + tail.next = node; + tail = node; + count++; + } + + public void pop(){ + if(isEmpty()){ + System.out.println("ѿ"); + return; + } + if(head == tail){ + head = null; + tail = null; + count--; + return; + } + MyNode temp = head; + head = head.next; + temp = null; + count--; + } + + public void printLLQueue(){ + if(isEmpty()){ + System.out.println("ǿյģ"); + return; + } + MyNode temp = head; + while(temp.next != null){ + System.out.print(temp.element+"-->"); + temp = temp.next; + } + System.out.println(temp.element); + } +} +class MyNode{ + int element; + MyNode next; + + public MyNode(){ + } + + public MyNode(int n){ + element = n; + } +} \ No newline at end of file diff --git a/base/base/work4/Main.class b/base/base/work4/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..6eee07ec1f1c61922c5f14bfea060cad18e16bed GIT binary patch literal 444 zcmYk1T}uK%7=_R5hpXe7+lTgHUU-!yBvjCa(oGNqTM}b>=UF_dSWpD-Ts3z&Y( zlXF-tub9!zSjxDfIfu=a`?u_+!%^mA(!oZVeia6+F=B(2J;rOX-=_O9{ZFarz+;Xw H{SA1(%IigZ literal 0 HcmV?d00001 diff --git a/base/base/work4/Main.java b/base/base/work4/Main.java new file mode 100644 index 0000000..f492fcc --- /dev/null +++ b/base/base/work4/Main.java @@ -0,0 +1,17 @@ +public class Main{ + public static void main(String args[]){ + LLQueue q = new LLQueue(5); + + q.push(10); + q.push(11); + q.push(12); + q.push(13); + q.push(14); + q.printLLQueue(); + + q.pop(); + q.pop(); + q.pop(); + q.printLLQueue(); + } +} \ No newline at end of file diff --git a/base/base/work4/MyNode.class b/base/base/work4/MyNode.class new file mode 100644 index 0000000000000000000000000000000000000000..aa43a3b9eaa9416e3abfca827ffdf04b49f7bf50 GIT binary patch literal 312 zcmYLDu}%U}5S%>@j(eVfVrQcrULlR0#Ky#gin&JENavK}an806)q& zPYa7TZ+CWPcE7$qJ^@_e#2`d3MgvC?jwAF1k(RnvR|#Y+2%WyNY}?7(bn~Rwg4U>T zMRg-+3@#oixFs#<+QR9yUgx@f$nug*I2il6S#0X>69b5kARe$g=P&%5=^paVg6oLp*Jv3r jArs?}=;bMSA8EWiJ>4Pr_jI@tn9*}j$DEE1`vBb^BS$Y5 literal 0 HcmV?d00001 diff --git a/base/work1/MainTest.class b/base/work1/MainTest.class new file mode 100644 index 0000000000000000000000000000000000000000..81172e28b9c456dd1bd78a3fc85a43a1b90b35ed GIT binary patch literal 442 zcmYL^+e*Vg5QhIvlctTSO^+UGgL8qCZdn!O$!P> zfDa|kEJ_3W?auDZe3S2=k1qhnXd1|&q@!#=L4{Fe)EIRg8#*=xvgdx_Cl>-4d;d;A zy$l~cfnv`Oyqk13^x}a#oYIXtbNxV|Za?%U?u*-0b*aYxS_ZkgC-G+>z6;n&=MiGZ~d+zuz+C?UIjEvJjp`4hP! z(k8MQ%^igiTF~iV`BNZRM_i+*NxPt3J6J-z(?P%_X5}R(7O+ldPJKm&ihU2has7=F&|uroWIw%aW&)P+J(V7u5|Dj$L^Sc(*@MNHP1P-5b=JHe^@G1<-< z>zxS^z3_?{zix^*#AqU*U1DkY0bcqWY~jv(W5nm3nSLl}vU$(WIq!MC-r4=-ujTsy zj$+C}4-TcU9nVS`l2Wi(iYXk%u!-j^9Kli9IcDOxf#)r>;gFOQCQi!wf|L;xqb5$7 zIBnoX17iwFrxZA|?<#1QCl!pU^M1+uz*SIuN(6PE9iv{&3r;KOxyivdxty(++0Z%V z)!f&b)fu<(hBH&)j^WLptNOtLFXjfP71~4O3yvS3C%yTJW~D*|zd8R7yL^FXuYmfl zOA&k^ujMzqS`h29O7&)A)}8Q#!oIK&ZWrd9_Z%Bp?6>h0`fTi!(u*B7_F=DqGd9L? zmLk^{KVG|ckgV<$RezzjcaP#YPm;n{*dv=G@ufA6un``M|9*n0k{3JyT(`S1-OECDd@8>WD)3 z6Sm0_##pKGUM{-0#ngzTo^*WQt(6saakP)M#J-6?^rZX$({Bd#C_07hxyOM=Fu)hJ zhi`TQnoNz~G#O#Ia-LibD2{g*>ux@s;km}OFMk&*uPs5#XP1!3=YK+C#ae=Xn}?hN zYcIC38qm3>V4{O{CoGXz%>a$O|o<^RIyTF2-LF`nLVRH8s}v@hSnwl87dK{8{sVBRL4p1(w3{q1S` z%w800k*vsC56$(Wlc}Yd)BxXqkx4~qih2h7W07-VguqD>q+$X~2*`8~ZI|xC-k_S+ z%cLr_(4OgNp|gdwH2#ZsHv#*}yNA33IKe!&@E*Xyn0GwRwlCss6Jx>~lF?RSGv*Ge z1`ZJSAaMuR@j8i=+wgHM4(j|CA6;=!+GzG`9NsjP$xwY(Y;^OBFlNP6=0 ;i-- ){ + //System.out.printf("aStack[%d]=%d",i,aStack[i]); + System.out.println("aStack["+i+"]="+aStack[i]); + } + } +} \ No newline at end of file diff --git a/base/work2/LLStack.class b/base/work2/LLStack.class new file mode 100644 index 0000000000000000000000000000000000000000..7364d2742be2649659f494d1dfe81ac8dcb81896 GIT binary patch literal 1760 zcmaJ?>rdNN7=BJ$`fJONQA^oii~;Hd3LD7SMGK6}VBiX47Ez`jEbz@CnP%*15I z8-CbgvMjr(2{SQ^m&Bn^CXjvfgMWshFh4Evvr(V-*HRj{nY8DezURF>&-=Uwe*1g% z0f2VAd1>L<{%9h3iT;Vy>^tN}&xByn6EophGLS{2;0nf5GgHPuSaRz* z^Pvl&iy&D0aRjm?XgSy{T|y+L%!&-~94& z=JTr?_b+eU|1R_Khg(YvkJfMN7{}{6-VjLRm|($&Uw@xj|0VP3s*ZDblZL#n!hRN$ zsy7xkf4;u?*|p4-dk-I6qwjY4@{P5tbok>=Ix~Ndhs^4Avq%v23YOZ76e`~__YTxE zlNXFBDp_C(UYboBQ8qiC;zfDDbPmT`My2bdW`v>~fwCu9;&4?ILLxyi3$LN0?9m#lB2L*4#3lGP>Vb$yuj7PFu)F5&b>b8-a)(Ec*WhPmSOQ( zmtpl)EyK1Gy&FaJaWYz7VKJYhjxv-m2gfv*shxSG@H4(8#xKFP0L^w6HtP>GT1*gj z)4>fNEk&@Db_-MvELVZv%3U&)NQSST67AiNF76iZW^6P0f-RCJ4f@h3x&{3w*gaYr zj>R=NC#qK98s5G+sGEEVCO1PioI}Cl1hqF zOF<4$k`|s?`D%|-hE57`idLcMgvI?AYBU@q&_j8J{v=Fk`OPdI6KIJ57253DF(O~X zu89?tdfaKVpOz(f(kSzI`7@1jI%lOaNlXg~A-RIxfr8jQPmLwtfKOO2L1!xxc}7NE2*q zf}i|b^8CLcd*Oe!fPaPX7sV=h*ybV#15L#EE2??N6PvJCysGFW7lFI~{JwJ|^IE8w xpTIi^ypzCB5O_Cr>Y+Bhq|ry1C((s|3{bC844PnFuu?HE6{{uWRx{s={{okzdtU$m literal 0 HcmV?d00001 diff --git a/base/work2/LLStack.java b/base/work2/LLStack.java new file mode 100644 index 0000000..3533004 --- /dev/null +++ b/base/work2/LLStack.java @@ -0,0 +1,86 @@ +public class LLStack{ + StackNode top; + private int count; + private int maxSize; + + public LLStack(){ + } + + public LLStack(int size){ //ջɵĴС + top = null; + count = 0; + maxSize = size; + } + + public boolean isFull(){ + return count == maxSize; + } + + public boolean isEmpty(){ + return count <=0 ; + } + + public void push(int value){ + if(isFull()){ + System.out.println("ջˣ"); + return; + } + StackNode node = new StackNode(value); + if(isEmpty()){ + top = node; + count++; + return; + } + node.next = top; + top = node; + count++; + } + + public void pop(){ + if(isEmpty()){ + System.out.println("ջǿյģ"); + return; + } + if(count==1){ + System.out.println("һԪأ"+top.element+""); + top = null; + count--; + return; + } + StackNode temp = new StackNode(); + System.out.println("Ԫأ"+top.element+""); + temp = top; + top = top.next; + temp.next = null; + count--; + } + + public void printLLStack(){ + if(isEmpty()){ + System.out.println("ջ޷ӡ"); + return; + } + System.out.println("ջջף"); + StackNode temp = new StackNode(); + temp = top; + while(temp.next != null){ + System.out.println(temp.element); + System.out.println(" v"); + temp = temp.next; + } + System.out.println(temp.element); + } + + +} +class StackNode{ + int element; + StackNode next; + + public StackNode(int n){ + element = n; + next = null; + } + public StackNode(){ + } +} diff --git a/base/work2/MainTest.class b/base/work2/MainTest.class new file mode 100644 index 0000000000000000000000000000000000000000..9bdd46c24fb56a415e5495e2076bb6f7dd6d59ad GIT binary patch literal 469 zcmZvZ%SyvQ7=_QIm$YMQ)4P{e&{eczMO=s$5xjs9b zfDa{}35pvB=9`&+&YyF_e15%s0N6)OB88leyo82=LQ$clP}Wh=u_TaedcGGP3&gC= zTY>oL=)o1p+Me%TPlp|M+;%zxR^mg)^99P*z1?@7oyNfNdyQ5&_Wa(FYLu zJSEOtQQUSX;f~T8NJ9$fw%rPy?vpw$8(2|Tg)~rAx2fM20rSt`rqg%3A>FOZC|xj} zJPH^AZNs0>F?lcwunwJntA+-l49NwaYFq`^#MT_*l^eE`$*8D=87y+Iq%VlE890B3 zc4x{tVs_n>GsNp=G2&W8E8?Ew3<=KUKQr-Xbw~sHGf^5QS*BT)AvS1j@ot;dUF7&+ Vc^sgCCW<&g31_Gv}cx1DCSDxSyl zM}0164NFtj7o7G+Cl4%_RA~my1GQm6i(ApQzKRdQl+) zL?K%6LTteo_|w{02}*Sz-aJ4%Q?LtSb~0HWZ2uHXUpU0aai;}8ZN-p5d8{fD4VJBt9ztyRd?Cq5v3GGtd zh^DJ*!fQKVss2@jajr|B^(C)Cs#=8O^epJ{Bs F`vV+4L^l8c literal 0 HcmV?d00001 diff --git a/base/work3/Main.java b/base/work3/Main.java new file mode 100644 index 0000000..e6f0ae0 --- /dev/null +++ b/base/work3/Main.java @@ -0,0 +1,14 @@ +public class Main{ + public static void main(String args[]){ + MyQueue queue = new MyQueue(10); + queue.push(10); + queue.push(20); + queue.push(30); + queue.push(40); + queue.push(50); + queue.printQueue(); + queue.pop(); + queue.pop(); + queue.printQueue(); + } +} \ No newline at end of file diff --git a/base/work3/MyQueue.class b/base/work3/MyQueue.class new file mode 100644 index 0000000000000000000000000000000000000000..da9377e22e1b1ec47e45a3c08b3f2543104ea53a GIT binary patch literal 1497 zcmaJ>&r@4f6#njeFL}x1Q6iH?Ajlj;<#WsB?9t**Lv9Pv9hA;oERk~t^$+;hJ3edpZCuYa#^ z0XTta2d(IhVjud%^otn~bJU?Z7RAdr9>EC*Cvi$5gAtszamIm*UNJ)v42vHT^GXC~ zCG*t?Ms1w4ab6)bmn&t93Ti^Zy5@Unx}q0k6ilyBP%z%*MR+902F0_CCA;5Y!i8Mg zS7@3Hvi{}L!mM9-+ndcWVkIZ!J{&BLmofs8?7phdI8*fIKAiIMwJbYW99zg2mzbX~ zEnZ_9zbLHl(hie;^FPAHy-FURR z{9yg&a2MTSy&f;0_p@Ad8`t$zN=*^*`<_+*Klzbjt~wNj zmgLjGL=0(e=-@+b<@2^+$kzDFkUeV8Rcg=W(%T#wcTM{OPaX7}BSNV)sJr~3kf3!~ zE~yqGjI`@CNx#Ur+{7h472kC3!$_I;VT!TDgr0yLL|8*vXyC_142@*Dhfk}CpnO)e z0(z2=!l5~}N*=2)ww7UAE3nKT88tMau+C_~ON@kI#72cSpA)S>9HkeCMuGV5KdKMx zR5y%Dc4u9cCy=b}O_dS;7VbUR&5<&qcT-mgXT48VLQ788RXJMmX^~l_R+ZVtX|+?> zA<9fpVh4ICQRtdbF}CZf&-@p?C19TIoLajE-EI};2%B%fy|SjY80>5Im$9e0sf<_| z&oQk^DlMesR+w#B>18-_TH!sNkkmJEa~IQ2M9Jp}nRb$C7nyc*Aw4*SUW}p-@1Y+b z@E=lGCt$|5F$Tj%lGCEymMQ5|Eyn7dXY^4`(vUe4uMzqIUH_I6*E*VabnN|9sg>>D pWY#SrzCO=Z_5lX@SWc7MAdX=OXE3Z;MPd8}L;Xpj3MpOE^AEnsCcOXv literal 0 HcmV?d00001 diff --git a/base/work3/MyQueue.java b/base/work3/MyQueue.java new file mode 100644 index 0000000..2124f4a --- /dev/null +++ b/base/work3/MyQueue.java @@ -0,0 +1,55 @@ +public class MyQueue{ + private int count; + private int head; + private int tail; + private int[] arr; + + public MyQueue(){ + } + + public MyQueue(int size){ + arr = new int[size]; + head = 0; + tail = 0; + count = 0; + } + + //---------------------------------------------- + + public boolean isFull(){ + return count == arr.length; + } + + public boolean isEmpty(){ + return count == 0; + } + + public void push(int value){ + if(isFull()){ + System.out.println("Ԫˣ"); + return; + } + count++; + arr[tail++] = value; + } + + public void pop(){ + if(isEmpty()){ + System.out.println("ѿ"); + return; + } + int temp = head; + + System.out.println(arr[head]+""); + count--; + head = (head == arr.length - 1 ? head : head+1); + arr[temp]=0; + } + + public void printQueue(){ + for(int i = 0;i <= arr.length-1 ;i++){ + System.out.print(arr[i]+" "); + } + System.out.println(""); + } +} \ No newline at end of file diff --git a/base/work4/LLQueue.class b/base/work4/LLQueue.class new file mode 100644 index 0000000000000000000000000000000000000000..82de29bcff8c59b3b680e03e1a79c36186925349 GIT binary patch literal 1615 zcmaKrUvCs;6vm%-cXnrYI%SuZLQ7FVDP5*rwm@6J{&8t-wJ=+Xi)g)a+D>3_|D~NZ z)H@R|y!S%n22G5_#Kb__Z9TaEKMzLC7Uv=j_(Kegz zlQ*4D91}Y!sOE$L+h1zWD0V&V$Fh-|AR2aT!Yl z49gak0TWjw_XGyp!=L={P@zA}eti2UZlB!w{Li01YyBx45RhESsa($$eR5x)se7e0 zciqIh!coLkmX*y;%j>pbYO zgJ7?kTar%kyRK7a`?_D^<~M?NmMYB4go$mm6Tu`a?k&pdZpkgXGWWPstGN|kjYAye z3pvdS`N8bV1pg;K;a9^ZDeTL<+ydIy zxjV{LagA9!Q1|(waE#VKgjT0qf*y{WR>J4#my-_Wq~Y9eIhiS|xplC?B9;H4y(A<^$+mi3XDQcVR5|@1Ua)%Jy2r zQYnpQE%QU#M^Y}&G`h^^{S*w@$5}Qw8l7WFaUf~_-1<0(BYXzfS&O3>Wf^1KO|dOA zEXyXV)S5&j{TGhu7$Wg-Yi4)JD?zfWAj>+gJkFwI*!Twj^o`CW}#a zSV?gB9Pto|he@0zagOXGNxoc?Wyx=xU(5YhMFB4eW2=fP~oh{`s9T;bE`bv9P(v*&<+)s8d9p hCTbo%xWG0G)GT*%xQO`x%|MjR)YwdmfF}cu+`m9TGvxpP literal 0 HcmV?d00001 diff --git a/base/work4/LLQueue.java b/base/work4/LLQueue.java new file mode 100644 index 0000000..e7625be --- /dev/null +++ b/base/work4/LLQueue.java @@ -0,0 +1,82 @@ +public class LLQueue{ + MyNode head; + MyNode tail; + int count; + int maxSize; + + public LLQueue(){ + } + + public LLQueue(int size){ + maxSize = size; + head = null; + tail = null; + count = 0; + } + + public boolean isFull(){ + return count == maxSize; + } + + public boolean isEmpty(){ + return count == 0; + } + + public void push(int value){ + if(isFull()){ + System.out.println(""); + return; + } + MyNode node = new MyNode(value); + if(count == 0){ + head = node; + tail = node; + count++; + return; + } + tail.next = node; + tail = node; + count++; + } + + public void pop(){ + if(isEmpty()){ + System.out.println("ѿ"); + return; + } + if(head == tail){ + head = null; + tail = null; + count--; + return; + } + MyNode temp = head; + head = head.next; + temp = null; + count--; + } + + public void printLLQueue(){ + if(isEmpty()){ + System.out.println("ǿյģ"); + return; + } + MyNode temp = head; + while(temp.next != null){ + System.out.print(temp.element+"-->"); + temp = temp.next; + } + System.out.println(temp.element); + } +} +class MyNode{ + int element; + MyNode next; + + public MyNode(){ + } + + public MyNode(int n){ + element = n; + } +} \ No newline at end of file diff --git a/base/work4/Main.class b/base/work4/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..6eee07ec1f1c61922c5f14bfea060cad18e16bed GIT binary patch literal 444 zcmYk1T}uK%7=_R5hpXe7+lTgHUU-!yBvjCa(oGNqTM}b>=UF_dSWpD-Ts3z&Y( zlXF-tub9!zSjxDfIfu=a`?u_+!%^mA(!oZVeia6+F=B(2J;rOX-=_O9{ZFarz+;Xw H{SA1(%IigZ literal 0 HcmV?d00001 diff --git a/base/work4/Main.java b/base/work4/Main.java new file mode 100644 index 0000000..f492fcc --- /dev/null +++ b/base/work4/Main.java @@ -0,0 +1,17 @@ +public class Main{ + public static void main(String args[]){ + LLQueue q = new LLQueue(5); + + q.push(10); + q.push(11); + q.push(12); + q.push(13); + q.push(14); + q.printLLQueue(); + + q.pop(); + q.pop(); + q.pop(); + q.printLLQueue(); + } +} \ No newline at end of file diff --git a/base/work4/MyNode.class b/base/work4/MyNode.class new file mode 100644 index 0000000000000000000000000000000000000000..aa43a3b9eaa9416e3abfca827ffdf04b49f7bf50 GIT binary patch literal 312 zcmYLDu}%U}5S%>@j(eVfVrQcrULlR0#Ky#gin&JENavK}an806)q& zPYa7TZ+CWPcE7$qJ^@_e#2`d3MgvC?jwAF1k(RnvR|#Y+2%WyNY}?7(bn~Rwg4U>T zMRg-+3@#oixFs#<+QR9yUgx@f$nug*I2il6S#0X>69b5kARe$g=P&%5=^paVg6oLp*Jv3r jArs?}=;bMSA8EWiJ>4Pr_jI@tn9*}j$DEE1`vBb^BS$Y5 literal 0 HcmV?d00001 -- Gitee