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 0000000000000000000000000000000000000000..ac7e603f607b06a8dea612634ab3d16bac6cb9d2 --- /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 0000000000000000000000000000000000000000..1ec69c41c0deeb98cfd6290e04f42c025b86b003 --- /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 0000000000000000000000000000000000000000..0fbd52fa8111ae13721da1f2c119822552292813 --- /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/base/base/work1/MainTest.class b/base/base/work1/MainTest.class new file mode 100644 index 0000000000000000000000000000000000000000..81172e28b9c456dd1bd78a3fc85a43a1b90b35ed Binary files /dev/null and b/base/base/work1/MainTest.class differ diff --git a/base/base/work1/MainTest.java b/base/base/work1/MainTest.java new file mode 100644 index 0000000000000000000000000000000000000000..75764aad874f16c688ba2648d2ca8d7d9c9391a3 --- /dev/null +++ b/base/base/work1/MainTest.java @@ -0,0 +1,20 @@ +public class MainTest +{ + public static void main(String args[]){ + //ջij + MyStack myStack = new MyStack(5); + + //myStack.printStack(); + + myStack.push(10); //ѹջ + myStack.push(20); + myStack.push(30); + myStack.push(40); + myStack.push(50); + myStack.printStack(); + + myStack.pop(); //ջջ + myStack.pop(); + myStack.printStack(); + } +} \ No newline at end of file diff --git a/base/base/work1/MyStack.class b/base/base/work1/MyStack.class new file mode 100644 index 0000000000000000000000000000000000000000..50b3d90702f458b9dfa5c08f730803a332b899c2 Binary files /dev/null and b/base/base/work1/MyStack.class differ diff --git a/base/base/work1/MyStack.java b/base/base/work1/MyStack.java new file mode 100644 index 0000000000000000000000000000000000000000..166938693335d810c3597316e37004a9b51f2ba5 --- /dev/null +++ b/base/base/work1/MyStack.java @@ -0,0 +1,54 @@ +public class MyStack +{ + private int[] aStack; + private int maxSize; + private int top = -1; + + public MyStack(int size){ //ջij + maxSize = size; + aStack = new int[maxSize]; + } + + public boolean isEmpty(){ + return top == -1; + } + + public boolean isFull(){ + return top == maxSize-1; + } + + public void push(int value){ + if(isFull()){ + System.out.println("ջˣ"); + return; + } + aStack[++top] = value; + } + + public void pop(){ + if(isEmpty()){ + System.out.println("ջǿյģ"); + return; + } + System.out.println(aStack[top--]+""); + } + + public int peek(){ + + if(isEmpty()){ + System.out.println("ջǿյģ"); + } + return aStack[top]; + } + + public void printStack(){ + if(isEmpty()){ + System.out.println("ջ޷ӡ"); + return; + } + for(int i=top ;i>=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 Binary files /dev/null and b/base/base/work2/LLStack.class differ diff --git a/base/base/work2/LLStack.java b/base/base/work2/LLStack.java new file mode 100644 index 0000000000000000000000000000000000000000..3533004b41c32d714947ae027c27a1356e1da9ad --- /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 Binary files /dev/null and b/base/base/work2/MainTest.class differ diff --git a/base/base/work2/MainTest.java b/base/base/work2/MainTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4ccc8c2585ecf362f1fe703e2d8b9de5ec9b7033 --- /dev/null +++ b/base/base/work2/MainTest.java @@ -0,0 +1,24 @@ +public class MainTest +{ + public static void main(String args[]){ + //ջij + LLStack llStack = new LLStack(10); + + //myStack.printStack(); + + llStack.push(10); //ѹջ + llStack.push(20); + llStack.push(30); + llStack.push(40); + llStack.push(50); + llStack.printLLStack(); + + llStack.pop(); + llStack.pop(); + llStack.pop(); + llStack.pop(); + llStack.pop(); + llStack.printLLStack(); + + } +} \ No newline at end of file diff --git a/base/base/work2/StackNode.class b/base/base/work2/StackNode.class new file mode 100644 index 0000000000000000000000000000000000000000..daec0574d14f4912bb22c24f25a95eeafd4ea6f6 Binary files /dev/null and b/base/base/work2/StackNode.class differ diff --git a/base/base/work3/Main.class b/base/base/work3/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..56a15f4088efd6861f965527e68aeab6dd598230 Binary files /dev/null and b/base/base/work3/Main.class differ diff --git a/base/base/work3/Main.java b/base/base/work3/Main.java new file mode 100644 index 0000000000000000000000000000000000000000..e6f0ae0ae9602452cd264a980834b5cfee0fef42 --- /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 Binary files /dev/null and b/base/base/work3/MyQueue.class differ diff --git a/base/base/work3/MyQueue.java b/base/base/work3/MyQueue.java new file mode 100644 index 0000000000000000000000000000000000000000..2124f4ace75f6a7228e4140eb8c35481f42fb0ba --- /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 Binary files /dev/null and b/base/base/work4/LLQueue.class differ diff --git a/base/base/work4/LLQueue.java b/base/base/work4/LLQueue.java new file mode 100644 index 0000000000000000000000000000000000000000..e7625be8d73c53a2e0c1bb38d7b992536b00d595 --- /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 Binary files /dev/null and b/base/base/work4/Main.class differ diff --git a/base/base/work4/Main.java b/base/base/work4/Main.java new file mode 100644 index 0000000000000000000000000000000000000000..f492fcc15cfadce333ac5945571a50cda4b0a01e --- /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 Binary files /dev/null and b/base/base/work4/MyNode.class differ diff --git a/base/work1/MainTest.class b/base/work1/MainTest.class new file mode 100644 index 0000000000000000000000000000000000000000..81172e28b9c456dd1bd78a3fc85a43a1b90b35ed Binary files /dev/null and b/base/work1/MainTest.class differ diff --git a/base/work1/MainTest.java b/base/work1/MainTest.java new file mode 100644 index 0000000000000000000000000000000000000000..75764aad874f16c688ba2648d2ca8d7d9c9391a3 --- /dev/null +++ b/base/work1/MainTest.java @@ -0,0 +1,20 @@ +public class MainTest +{ + public static void main(String args[]){ + //ջij + MyStack myStack = new MyStack(5); + + //myStack.printStack(); + + myStack.push(10); //ѹջ + myStack.push(20); + myStack.push(30); + myStack.push(40); + myStack.push(50); + myStack.printStack(); + + myStack.pop(); //ջջ + myStack.pop(); + myStack.printStack(); + } +} \ No newline at end of file diff --git a/base/work1/MyStack.class b/base/work1/MyStack.class new file mode 100644 index 0000000000000000000000000000000000000000..50b3d90702f458b9dfa5c08f730803a332b899c2 Binary files /dev/null and b/base/work1/MyStack.class differ diff --git a/base/work1/MyStack.java b/base/work1/MyStack.java new file mode 100644 index 0000000000000000000000000000000000000000..166938693335d810c3597316e37004a9b51f2ba5 --- /dev/null +++ b/base/work1/MyStack.java @@ -0,0 +1,54 @@ +public class MyStack +{ + private int[] aStack; + private int maxSize; + private int top = -1; + + public MyStack(int size){ //ջij + maxSize = size; + aStack = new int[maxSize]; + } + + public boolean isEmpty(){ + return top == -1; + } + + public boolean isFull(){ + return top == maxSize-1; + } + + public void push(int value){ + if(isFull()){ + System.out.println("ջˣ"); + return; + } + aStack[++top] = value; + } + + public void pop(){ + if(isEmpty()){ + System.out.println("ջǿյģ"); + return; + } + System.out.println(aStack[top--]+""); + } + + public int peek(){ + + if(isEmpty()){ + System.out.println("ջǿյģ"); + } + return aStack[top]; + } + + public void printStack(){ + if(isEmpty()){ + System.out.println("ջ޷ӡ"); + return; + } + for(int i=top ;i>=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 Binary files /dev/null and b/base/work2/LLStack.class differ diff --git a/base/work2/LLStack.java b/base/work2/LLStack.java new file mode 100644 index 0000000000000000000000000000000000000000..3533004b41c32d714947ae027c27a1356e1da9ad --- /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 Binary files /dev/null and b/base/work2/MainTest.class differ diff --git a/base/work2/MainTest.java b/base/work2/MainTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4ccc8c2585ecf362f1fe703e2d8b9de5ec9b7033 --- /dev/null +++ b/base/work2/MainTest.java @@ -0,0 +1,24 @@ +public class MainTest +{ + public static void main(String args[]){ + //ջij + LLStack llStack = new LLStack(10); + + //myStack.printStack(); + + llStack.push(10); //ѹջ + llStack.push(20); + llStack.push(30); + llStack.push(40); + llStack.push(50); + llStack.printLLStack(); + + llStack.pop(); + llStack.pop(); + llStack.pop(); + llStack.pop(); + llStack.pop(); + llStack.printLLStack(); + + } +} \ No newline at end of file diff --git a/base/work2/StackNode.class b/base/work2/StackNode.class new file mode 100644 index 0000000000000000000000000000000000000000..daec0574d14f4912bb22c24f25a95eeafd4ea6f6 Binary files /dev/null and b/base/work2/StackNode.class differ diff --git a/base/work3/Main.class b/base/work3/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..56a15f4088efd6861f965527e68aeab6dd598230 Binary files /dev/null and b/base/work3/Main.class differ diff --git a/base/work3/Main.java b/base/work3/Main.java new file mode 100644 index 0000000000000000000000000000000000000000..e6f0ae0ae9602452cd264a980834b5cfee0fef42 --- /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 Binary files /dev/null and b/base/work3/MyQueue.class differ diff --git a/base/work3/MyQueue.java b/base/work3/MyQueue.java new file mode 100644 index 0000000000000000000000000000000000000000..2124f4ace75f6a7228e4140eb8c35481f42fb0ba --- /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 Binary files /dev/null and b/base/work4/LLQueue.class differ diff --git a/base/work4/LLQueue.java b/base/work4/LLQueue.java new file mode 100644 index 0000000000000000000000000000000000000000..e7625be8d73c53a2e0c1bb38d7b992536b00d595 --- /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 Binary files /dev/null and b/base/work4/Main.class differ diff --git a/base/work4/Main.java b/base/work4/Main.java new file mode 100644 index 0000000000000000000000000000000000000000..f492fcc15cfadce333ac5945571a50cda4b0a01e --- /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 Binary files /dev/null and b/base/work4/MyNode.class differ