From 37b538fa44e1c789ccf54a7daf6a486bc40765d4 Mon Sep 17 00:00:00 2001 From: Li <1254705596@qq.com> Date: Wed, 28 Oct 2020 09:33:47 +0800 Subject: [PATCH 1/6] 123 --- 666.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 666.txt diff --git a/666.txt b/666.txt new file mode 100644 index 0000000..d91db81 --- /dev/null +++ b/666.txt @@ -0,0 +1 @@ +4566 \ No newline at end of file -- Gitee From f88cf6917aa4a60f8414f50f7cc20b6deb39d585 Mon Sep 17 00:00:00 2001 From: Li <1254705596@qq.com> Date: Tue, 3 Nov 2020 23:39:46 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.idea/misc.xml" | 6 ++ .../.idea/modules.xml" | 8 ++ .../.idea/workspace.xml" | 94 ++++++++++++++++ .../LinkList.iml" | 11 ++ .../out/production/LinkList/LinkedList.class" | Bin 0 -> 2672 bytes .../out/production/LinkList/Main.class" | Bin 0 -> 911 bytes .../out/production/LinkList/NodeList.class" | Bin 0 -> 545 bytes .../src/LinkedList.java" | 101 ++++++++++++++++++ .../src/Main.java" | 13 +++ .../src/Node.java" | 9 ++ Node.class | Bin 0 -> 424 bytes 11 files changed, 242 insertions(+) create mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/misc.xml" create mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/modules.xml" create mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/workspace.xml" create mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/LinkList.iml" create mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/out/production/LinkList/LinkedList.class" create mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/out/production/LinkList/Main.class" create mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/out/production/LinkList/NodeList.class" create mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/src/LinkedList.java" create mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/src/Main.java" create mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/src/Node.java" create mode 100644 Node.class diff --git "a/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/misc.xml" "b/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/misc.xml" new file mode 100644 index 0000000..e0844bc --- /dev/null +++ "b/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/misc.xml" @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git "a/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/modules.xml" "b/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/modules.xml" new file mode 100644 index 0000000..7fdd3c6 --- /dev/null +++ "b/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/modules.xml" @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git "a/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/workspace.xml" "b/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/workspace.xml" new file mode 100644 index 0000000..8ad43b2 --- /dev/null +++ "b/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/workspace.xml" @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1604402319167 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/23\346\235\216\351\224\256\344\275\234\344\270\232/LinkList.iml" "b/23\346\235\216\351\224\256\344\275\234\344\270\232/LinkList.iml" new file mode 100644 index 0000000..c90834f --- /dev/null +++ "b/23\346\235\216\351\224\256\344\275\234\344\270\232/LinkList.iml" @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git "a/23\346\235\216\351\224\256\344\275\234\344\270\232/out/production/LinkList/LinkedList.class" "b/23\346\235\216\351\224\256\344\275\234\344\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ya6DfYBtdq2gHbnU0M;v%;gOyOsocexial9?L!4}I=Kc;E`Ofe7yN9Fc00 zk)9YOUc@0g-*%w|p?}cLF7WqQTWg}O86$+~-Lx09qM;GD8SFq)wF7}iLeWd?qVZc0 z3c5bh_jf?#>s_=1R1z>veli?g;Psl}^}0w+Wr=2%Y+WWhb9LGpsns`9t1so(mt-!l zDv9!{lBlY-_z%}>w6i4sd3WqXUZ0O@&(e=9NG|A*6qFutOXy-v95p`Y6M%Ij#G77w z^Ox^lN9)^X!@C_fSj|m79P_*&lCW=QoxRrCdw&1<@e9CxyfAPYOB$99#ITgc4fZQ(+)Sg$VTsKu zo3f5uxXn?;Koxg5TH|P4Lrue7fmB0zDr^eGi=~c0V#{}=z`UhA`D!%i%3#Otx>U(p ze$RG0cAz+)78Bt|HKZQaOIvw$x;-E-kT1Ts_UzAg)wR8TwH*e^>(`_1cF-q$?u283 znCl9d7BPR4j-`enHOwDpJ=p)pT$sT%{wHhFU8C)ff}Y$~EMI4Z6&7V8iyWOE@d$`D z6Zfz|!8-kGCe3)m!~-@Dk<+kgqK<}%M`&tzY~l%?ns|mSj-J!Axw*i?(VJg)_hc_5 z7Ta-l{O!Q^C|NAd2%R9Jspt{tt+WGyj3Zqc%2p@`G$>=AMi)+#nfC32ApvM-{)qcd z+A6>LhT$}CX%BcCL-mE8PK#~P%p-BfF#=jd;F9=6vBewGKPb%F?LeGOm!QtCX?aNu@xMpqKNTum1%BRkm&b literal 0 HcmV?d00001 diff --git "a/23\346\235\216\351\224\256\344\275\234\344\270\232/out/production/LinkList/NodeList.class" "b/23\346\235\216\351\224\256\344\275\234\344\270\232/out/production/LinkList/NodeList.class" new file mode 100644 index 0000000000000000000000000000000000000000..c8c9aa178ea303e0a0974ba654cd495691bfbf80 GIT binary patch literal 545 zcmZWl%TB^T6g@)=Sg3#~_%<#JCbBe9!p6i^g9{q=15R)diYdkDXSpCIF8lyL%6LYg z36ja&nS1U%=RUrFKED85;Vg$V4jkAxH0CIa<19`DY#pnyK-nM47ugueaL~B#4OKtB z5pX(s5XyKKDFG`8h}fZejRkUkd-9-sJvCXy#A!08MI_VIp^jSu6>n3v)}_oX>4vF8 z)t-%eDhgz8M5OFb`f}8jkv9GkwBtuT6{xPq-kw+SjK{i0)@ugWn+02&5GUwNW>H_= zX;alP(_ESbxY)+2iyZPUGRO*Stp*h+{ofFm;?=r1=Q`8eaf+85ko4y{v=mBwmp@Ry zz|10lPkarhSpR^ii#byDi#e=!LKaH2WeS7RHjhK;0>yWTR2MYH^YkdNEW5iFbCZ~p Pw6I6!qPYrHOw0SfU~pyO literal 0 HcmV?d00001 diff --git "a/23\346\235\216\351\224\256\344\275\234\344\270\232/src/LinkedList.java" "b/23\346\235\216\351\224\256\344\275\234\344\270\232/src/LinkedList.java" new file mode 100644 index 0000000..bf74782 --- /dev/null +++ "b/23\346\235\216\351\224\256\344\275\234\344\270\232/src/LinkedList.java" @@ -0,0 +1,101 @@ +public class LinkedList { + private NodeList head; + private NodeList tail; //尾指针用来标记最后一个结点的位置 + private int size;//长度用来标记长度 + public LinkedList() { + head = null; + } + + public void addToFront(T item) { + NodeList node = new NodeList(item); + + if (this.head == null) { + this.head = node; + } else{ + NodeList temp = head; + node.next=temp; + head = node; + } + this.size++; + } + + public int size(){ + return this.size; + } + + public void addToRear(T item) { + NodeList newNode = new NodeList(item); + if (this.head == null) { + this.head = newNode; + } + this.tail = newNode; + this.size++; + } + + public void deleteItems(T item){ + NodeList temp=this.head; + NodeList pretemp=new NodeList(item); + pretemp=temp; + if(temp==null){ + System.out.println("empty"); + return; + } + while(temp.next!=null){ + // System.out.println("temp"+temp.item); + // System.out.println("ll"+this.head.item); + if(temp.item.equals(item)){ + if(this.head.item.equals(item)){ + pretemp=this.head.next; + this.head.next=pretemp.next; + this.head=pretemp; + + // System.out.println("testss"+this.head.item); + break; + } + System.out.println("delete"); + pretemp.next=temp.next; + break; + }else + { + System.out.println("no delete"); + pretemp=temp; + temp=temp.next; + + } + + } + if(temp.next==null){ + temp.item=null; + temp.next=null; + } + this.tail=temp; + // System.out.println(tail.item); + this.size--; + } + + public boolean findItems(T item){ + NodeList temp=this.head; + if(temp==null){ + System.out.println("empty"); + return false; + } + while(temp.next!=null){ + if(temp.item.equals(item)) + { + return true; + } + temp=temp.next; + } + return false; + } + + public void printItems() { + NodeList temp = this.head; + // System.out.println("testss"+temp.item); + while(temp.next != null){ + System.out.print(temp.item + " -> "); + temp = temp.next; + } + System.out.println(temp.item); + } +} diff --git "a/23\346\235\216\351\224\256\344\275\234\344\270\232/src/Main.java" "b/23\346\235\216\351\224\256\344\275\234\344\270\232/src/Main.java" new file mode 100644 index 0000000..65496e3 --- /dev/null +++ "b/23\346\235\216\351\224\256\344\275\234\344\270\232/src/Main.java" @@ -0,0 +1,13 @@ +public class Main { + public static void main(String args[]) { + LinkedList ll = new LinkedList(); + ll.addToFront("1"); + ll.addToFront("2"); + ll.addToRear("3"); + ll.deleteItems("1"); + ll.printItems(); + + System.out.println(ll.size()); + System.out.println(ll.findItems("2")); + } +} diff --git "a/23\346\235\216\351\224\256\344\275\234\344\270\232/src/Node.java" "b/23\346\235\216\351\224\256\344\275\234\344\270\232/src/Node.java" new file mode 100644 index 0000000..2e1595f --- /dev/null +++ "b/23\346\235\216\351\224\256\344\275\234\344\270\232/src/Node.java" @@ -0,0 +1,9 @@ + + class NodeList { + T item; + NodeList next = null; + NodeList(T item) { + this.item = item; + } + } + diff --git a/Node.class b/Node.class new file mode 100644 index 0000000000000000000000000000000000000000..f3a6d714a73a506f60c219b2e1abad3f4cd3565d GIT binary patch literal 424 zcmZXQ&rX9t5XQd+3PQ0cTK}HBQB3T?gNYI@rk+SWwCNq{rrD;Y38BW<^3a%g@Bw@% zLGPrMQ(`HJ*8?DyWR6Z#UaP^07^b9`sapA*5+lLK@P4$z& z!T$j{Q`DQ_irZ*$MFtP+A+WcNTv|f@VxJz!?yxeTcgtIAg7^a>78@Ax^#R%9I?j0@h`_eP6hw~ literal 0 HcmV?d00001 -- Gitee From f15a81cc1cf65f9c6359dfa4f408843f5645f34f Mon Sep 17 00:00:00 2001 From: Li <1254705596@qq.com> Date: Wed, 4 Nov 2020 08:12:07 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.idea/misc.xml" | 6 -- .../.idea/modules.xml" | 8 -- .../.idea/workspace.xml" | 94 ------------------ .../out/production/LinkList/LinkedList.class" | Bin 2672 -> 0 bytes .../out/production/LinkList/Main.class" | Bin 911 -> 0 bytes .../out/production/LinkList/NodeList.class" | Bin 545 -> 0 bytes 6 files changed, 108 deletions(-) delete mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/misc.xml" delete mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/modules.xml" delete mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/workspace.xml" delete mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/out/production/LinkList/LinkedList.class" delete mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/out/production/LinkList/Main.class" delete mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/out/production/LinkList/NodeList.class" diff --git "a/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/misc.xml" "b/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/misc.xml" deleted file mode 100644 index e0844bc..0000000 --- "a/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/misc.xml" +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git "a/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/modules.xml" "b/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/modules.xml" deleted file mode 100644 index 7fdd3c6..0000000 --- "a/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/modules.xml" +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git "a/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/workspace.xml" "b/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/workspace.xml" deleted file mode 100644 index 8ad43b2..0000000 --- "a/23\346\235\216\351\224\256\344\275\234\344\270\232/.idea/workspace.xml" +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1604402319167 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git "a/23\346\235\216\351\224\256\344\275\234\344\270\232/out/production/LinkList/LinkedList.class" "b/23\346\235\216\351\224\256\344\275\234\344\270\232/out/production/LinkList/LinkedList.class" deleted file mode 100644 index aad862a34aef4340f7cecb4273dcdb9259e1aebc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2672 zcmaJ@-%k`*6#g#zdl_H>5lh9c3Kn63Vr#2{SVd9nvQl?Z@keFY9bsgdp}VtMoAj+O zeQ8Yk(E3o5rVqUMVxyR7(xfk%^#5r3PuSY;%*?LKk2JuXd(S=h-0ytnyEpv#@AKaQ ze1gR|+HoX?HXM!MSR4V2#`qZ%&vE&T$8Z9lMsYHZQ<#vo)3W7E6q8Y$ZDW$pWF;-1 z=?F3rTu=xu8G1n>p3c|>BW;$QQTiO+EYg(CuMGt?r4Sx7Ez=oS2=pDi#FYsKE3~9d z%g9t#7K~C(UntVkmbUYH@seILW$rtJ&XQSH(9#TFHVXbBJ2!^jTdjt-*2RtGa--u! z6xR!doIP2xEk~iFFMV6TqYoE#YjOC(!fhk(jJl{CV`Y`#Oj?1mC5UU53p~KI3Qbu@ z&o58wt3J+H)?Bo7r&3}e;XZ~)QWnhmWA6DE4ZWlgv5dPymO^8}C>oA2#q(HSWVOVJ zAc);Et%C2}7VOpP0UX3vOQz-c(S2jNV_R{LZ*_5B)~=ND#-u5{ODBA4hoo!`@1RS= z4s<9)tDP0+eho9|(9nrp8g`;1g3mQvL{=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qcd z+A6>LhT$}CX%BcCL-mE8PK#~P%p-BfF#=jd;F9=6vBewGKPb%F?LeGOm!QtCX?aNu@xMpqKNTum1%BRkm&b diff --git "a/23\346\235\216\351\224\256\344\275\234\344\270\232/out/production/LinkList/NodeList.class" "b/23\346\235\216\351\224\256\344\275\234\344\270\232/out/production/LinkList/NodeList.class" deleted file mode 100644 index c8c9aa178ea303e0a0974ba654cd495691bfbf80..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 545 zcmZWl%TB^T6g@)=Sg3#~_%<#JCbBe9!p6i^g9{q=15R)diYdkDXSpCIF8lyL%6LYg z36ja&nS1U%=RUrFKED85;Vg$V4jkAxH0CIa<19`DY#pnyK-nM47ugueaL~B#4OKtB z5pX(s5XyKKDFG`8h}fZejRkUkd-9-sJvCXy#A!08MI_VIp^jSu6>n3v)}_oX>4vF8 z)t-%eDhgz8M5OFb`f}8jkv9GkwBtuT6{xPq-kw+SjK{i0)@ugWn+02&5GUwNW>H_= zX;alP(_ESbxY)+2iyZPUGRO*Stp*h+{ofFm;?=r1=Q`8eaf+85ko4y{v=mBwmp@Ry zz|10lPkarhSpR^ii#byDi#e=!LKaH2WeS7RHjhK;0>yWTR2MYH^YkdNEW5iFbCZ~p Pw6I6!qPYrHOw0SfU~pyO -- Gitee From e112f10745db282f684dbe7752616dfc15f68e47 Mon Sep 17 00:00:00 2001 From: Li <1254705596@qq.com> Date: Wed, 4 Nov 2020 08:18:06 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LinkList.iml" | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 "23\346\235\216\351\224\256\344\275\234\344\270\232/LinkList.iml" diff --git "a/23\346\235\216\351\224\256\344\275\234\344\270\232/LinkList.iml" "b/23\346\235\216\351\224\256\344\275\234\344\270\232/LinkList.iml" deleted file mode 100644 index c90834f..0000000 --- "a/23\346\235\216\351\224\256\344\275\234\344\270\232/LinkList.iml" +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file -- Gitee From c65d152fafda5586e3794607e1e2f0e83f28c8f0 Mon Sep 17 00:00:00 2001 From: Li <1254705596@qq.com> Date: Tue, 17 Nov 2020 21:36:39 +0800 Subject: [PATCH 5/6] =?UTF-8?q?m=E5=AE=8C=E6=88=90=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git commit -am完成作业 git commit -am m完成作业 --- .../src/ArrayQueue.java" | 47 ++++++++++++++++ .../src/LinkListQueue.java" | 56 +++++++++++++++++++ .../src/LinkListStack.java" | 55 ++++++++++++++++++ .../src/Stack.java" | 51 +++++++++++++++++ 4 files changed, 209 insertions(+) create mode 100644 "23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/ArrayQueue.java" create mode 100644 "23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/LinkListQueue.java" create mode 100644 "23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/LinkListStack.java" create mode 100644 "23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/Stack.java" diff --git "a/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/ArrayQueue.java" "b/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/ArrayQueue.java" new file mode 100644 index 0000000..f616314 --- /dev/null +++ "b/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/ArrayQueue.java" @@ -0,0 +1,47 @@ +public class ArrayQueue { + int front,rear,nowsize; + int capacity; + int arrayQueue[]; + public ArrayQueue(int capacity){ + this.capacity = capacity; + front = rear = nowsize =0; + arrayQueue =new int[capacity]; + + } + public boolean NullArrayQueue(){ //队列为空 + return nowsize == 0; + } + public boolean FullQueue(){ + return nowsize == capacity; + } + public void enQueue(int item) { + if (FullQueue()) + // return; + System.out.println("队列已满"); + else { + arrayQueue[rear] = item; + rear = (rear + 1) % capacity; + nowsize++; + System.out.println(item + "入队"); + } + } + public void outQueue(){ + if(NullArrayQueue()){ + System.out.println("队列为空"); + } + else { + int val = arrayQueue[front]; + front = (front + 1) % capacity; + nowsize--; + System.out.println(val + "出队"); + } + } + public static void main(String args[]){ + ArrayQueue test1 = new ArrayQueue(20); + test1.enQueue(1); + test1.enQueue(2); + test1.enQueue(3); + test1.outQueue(); + + } +} diff --git "a/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/LinkListQueue.java" "b/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/LinkListQueue.java" new file mode 100644 index 0000000..2319c3e --- /dev/null +++ "b/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/LinkListQueue.java" @@ -0,0 +1,56 @@ +import jdk.swing.interop.SwingInterOpUtils; + +public class LinkListQueue { + Queue front; + Queue rear; + + static class Queue { + int value; + Queue next; + + public Queue(int value) { + this.value = value; + } + } + public void enQueue(int value){ + Queue newNode = new Queue(value); + if(this.rear ==null){ + this.front = this.rear = newNode; + return; + } + this.rear.next = newNode; + this.rear = newNode; + + } + public void PrintQueue(){ + Queue temp=this.front; + while (temp!=null){ + System.out.print(temp.value+"==>"); + temp=temp.next; + } + System.out.println(); + } + public int outQueue(){ + if(this.front == null){ + System.out.println("队列为空"); + } + Queue front = this.front; + this.front = this.front.next; + if(this.front ==null){ //如果只有一个节点 + this.rear = null; + } + return front.value; + } + + public static void main(String[] args) { + LinkListQueue test3 = new LinkListQueue(); + test3.enQueue(1); + test3.enQueue(1); + test3.enQueue(2); + test3.enQueue(3); + test3.outQueue(); + test3.PrintQueue(); + + } + } + diff --git "a/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/LinkListStack.java" "b/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/LinkListStack.java" new file mode 100644 index 0000000..7d010d2 --- /dev/null +++ "b/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/LinkListStack.java" @@ -0,0 +1,55 @@ +public class LinkListStack { + int value; + StackNode TopofNode; + public class StackNode{ + int value; + StackNode next; + + public StackNode(int value){ + this.value = value; + } + } + public LinkListStack(){ + TopofNode = null; + } + public void push(int value){ + StackNode newNode = new StackNode(value); + if(TopofNode == null){ + TopofNode = newNode; + } + else { + StackNode preNode = TopofNode; //将原来的节点先保存在上一个节点 + TopofNode = newNode; //将新压栈节点保存在栈顶 + newNode.next = preNode; + } + System.out.println("以入栈"); + } + public void pop(){ + if(TopofNode == null){ + System.out.println("栈为空"); + } + else{ + StackNode popNode = TopofNode; + TopofNode = TopofNode.next; + } + System.out.println("出栈成功"); + } + public int peek(){ + if(TopofNode == null){ + System.out.println("栈为空"); + } + + return TopofNode.value; + } + public static void main(String[] args) { + LinkListStack item = new LinkListStack(); + item.push(1); + item.push(2); + item.push(3); + item.pop(); + item.pop(); + item.peek(); + } +} + + diff --git "a/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/Stack.java" "b/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/Stack.java" new file mode 100644 index 0000000..3e33873 --- /dev/null +++ "b/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/Stack.java" @@ -0,0 +1,51 @@ +import jdk.swing.interop.SwingInterOpUtils; + +public class Stack { + static final int A = 1997; + private int[] stack; + private int topofstack; //栈顶 + + public Stack() { //初始化一个栈 长度为20 + topofstack = -1; + stack = new int[A]; + } + public boolean push(int val){ + if(topofstack >= A){ + System.out.println("栈满"); + return false; + } + stack[++topofstack] = val; + topofstack++; + return true; + } + public void pop() { + if (topofstack < 0) { + System.out.println("栈为空,没有可以元素可以出栈"); + + } else { + stack[topofstack] = 0; //将栈顶的元素置为空 + topofstack--; //指针减一 + } + } + public int peek(){ + if(topofstack < 0){ + System.out.println("没有元素"); + return -1; + } + else { + return stack[topofstack]; + } + } + public static void main(String[] args) { + Stack test1 = new Stack(); + test1.push(1); + test1.push(9); + test1.push(9); + System.out.println(test1.push(7)); + for (int a = 0;a < 4;a++){ + System.out.println(test1.stack[a]); + } + } +} + + -- Gitee From e8c170b9fc83ba41fe5c9d7953bacb8a8d80f598 Mon Sep 17 00:00:00 2001 From: Li <1254705596@qq.com> Date: Tue, 17 Nov 2020 21:44:32 +0800 Subject: [PATCH 6/6] a --- .../src/ArrayQueue.java" | 47 ---------------- .../src/LinkListQueue.java" | 56 ------------------- .../src/LinkListStack.java" | 55 ------------------ .../src/Stack.java" | 51 ----------------- 4 files changed, 209 deletions(-) delete mode 100644 "23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/ArrayQueue.java" delete mode 100644 "23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/LinkListQueue.java" delete mode 100644 "23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/LinkListStack.java" delete mode 100644 "23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/Stack.java" diff --git "a/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/ArrayQueue.java" "b/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/ArrayQueue.java" deleted file mode 100644 index f616314..0000000 --- "a/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/ArrayQueue.java" +++ /dev/null @@ -1,47 +0,0 @@ -public class ArrayQueue { - int front,rear,nowsize; - int capacity; - int arrayQueue[]; - public ArrayQueue(int capacity){ - this.capacity = capacity; - front = rear = nowsize =0; - arrayQueue =new int[capacity]; - - } - public boolean NullArrayQueue(){ //队列为空 - return nowsize == 0; - } - public boolean FullQueue(){ - return nowsize == capacity; - } - public void enQueue(int item) { - if (FullQueue()) - // return; - System.out.println("队列已满"); - else { - arrayQueue[rear] = item; - rear = (rear + 1) % capacity; - nowsize++; - System.out.println(item + "入队"); - } - } - public void outQueue(){ - if(NullArrayQueue()){ - System.out.println("队列为空"); - } - else { - int val = arrayQueue[front]; - front = (front + 1) % capacity; - nowsize--; - System.out.println(val + "出队"); - } - } - public static void main(String args[]){ - ArrayQueue test1 = new ArrayQueue(20); - test1.enQueue(1); - test1.enQueue(2); - test1.enQueue(3); - test1.outQueue(); - - } -} diff --git "a/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/LinkListQueue.java" "b/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/LinkListQueue.java" deleted file mode 100644 index 2319c3e..0000000 --- "a/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/LinkListQueue.java" +++ /dev/null @@ -1,56 +0,0 @@ -import jdk.swing.interop.SwingInterOpUtils; - -public class LinkListQueue { - Queue front; - Queue rear; - - static class Queue { - int value; - Queue next; - - public Queue(int value) { - this.value = value; - } - } - public void enQueue(int value){ - Queue newNode = new Queue(value); - if(this.rear ==null){ - this.front = this.rear = newNode; - return; - } - this.rear.next = newNode; - this.rear = newNode; - - } - public void PrintQueue(){ - Queue temp=this.front; - while (temp!=null){ - System.out.print(temp.value+"==>"); - temp=temp.next; - } - System.out.println(); - } - public int outQueue(){ - if(this.front == null){ - System.out.println("队列为空"); - } - Queue front = this.front; - this.front = this.front.next; - if(this.front ==null){ //如果只有一个节点 - this.rear = null; - } - return front.value; - } - - public static void main(String[] args) { - LinkListQueue test3 = new LinkListQueue(); - test3.enQueue(1); - test3.enQueue(1); - test3.enQueue(2); - test3.enQueue(3); - test3.outQueue(); - test3.PrintQueue(); - - } - } - diff --git "a/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/LinkListStack.java" "b/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/LinkListStack.java" deleted file mode 100644 index 7d010d2..0000000 --- "a/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/LinkListStack.java" +++ /dev/null @@ -1,55 +0,0 @@ -public class LinkListStack { - int value; - StackNode TopofNode; - public class StackNode{ - int value; - StackNode next; - - public StackNode(int value){ - this.value = value; - } - } - public LinkListStack(){ - TopofNode = null; - } - public void push(int value){ - StackNode newNode = new StackNode(value); - if(TopofNode == null){ - TopofNode = newNode; - } - else { - StackNode preNode = TopofNode; //将原来的节点先保存在上一个节点 - TopofNode = newNode; //将新压栈节点保存在栈顶 - newNode.next = preNode; - } - System.out.println("以入栈"); - } - public void pop(){ - if(TopofNode == null){ - System.out.println("栈为空"); - } - else{ - StackNode popNode = TopofNode; - TopofNode = TopofNode.next; - } - System.out.println("出栈成功"); - } - public int peek(){ - if(TopofNode == null){ - System.out.println("栈为空"); - } - - return TopofNode.value; - } - public static void main(String[] args) { - LinkListStack item = new LinkListStack(); - item.push(1); - item.push(2); - item.push(3); - item.pop(); - item.pop(); - item.peek(); - } -} - - diff --git "a/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/Stack.java" "b/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/Stack.java" deleted file mode 100644 index 3e33873..0000000 --- "a/23 \346\235\216\351\224\256 \346\240\210\345\222\214\351\230\237\345\210\227/src/Stack.java" +++ /dev/null @@ -1,51 +0,0 @@ -import jdk.swing.interop.SwingInterOpUtils; - -public class Stack { - static final int A = 1997; - private int[] stack; - private int topofstack; //栈顶 - - public Stack() { //初始化一个栈 长度为20 - topofstack = -1; - stack = new int[A]; - } - public boolean push(int val){ - if(topofstack >= A){ - System.out.println("栈满"); - return false; - } - stack[++topofstack] = val; - topofstack++; - return true; - } - public void pop() { - if (topofstack < 0) { - System.out.println("栈为空,没有可以元素可以出栈"); - - } else { - stack[topofstack] = 0; //将栈顶的元素置为空 - topofstack--; //指针减一 - } - } - public int peek(){ - if(topofstack < 0){ - System.out.println("没有元素"); - return -1; - } - else { - return stack[topofstack]; - } - } - public static void main(String[] args) { - Stack test1 = new Stack(); - test1.push(1); - test1.push(9); - test1.push(9); - System.out.println(test1.push(7)); - for (int a = 0;a < 4;a++){ - System.out.println(test1.stack[a]); - } - } -} - - -- Gitee