From 42b3ccfab356339d3510fa46d4439c7c472f464e Mon Sep 17 00:00:00 2001 From: azooh10 <735841160@qq.com> Date: Mon, 2 Nov 2020 16:20:28 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LinkedList.java => src/LinkedList.java | 0 Main.java => src/Main.java | 0 Node.java => src/Node.java | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename LinkedList.java => src/LinkedList.java (100%) rename Main.java => src/Main.java (100%) rename Node.java => src/Node.java (77%) diff --git a/LinkedList.java b/src/LinkedList.java similarity index 100% rename from LinkedList.java rename to src/LinkedList.java diff --git a/Main.java b/src/Main.java similarity index 100% rename from Main.java rename to src/Main.java diff --git a/Node.java b/src/Node.java similarity index 77% rename from Node.java rename to src/Node.java index ed7a352..bae016f 100644 --- a/Node.java +++ b/src/Node.java @@ -1,6 +1,6 @@ public class Node { E item; - Node next = null; + Node next =null; Node(E item) { this.item = item; -- Gitee From 9fbdec431a876172c2b4e1ebc86b50a18ab62ac0 Mon Sep 17 00:00:00 2001 From: yelion Date: Mon, 2 Nov 2020 18:09:21 +0800 Subject: [PATCH 2/4] AutoPush --- "1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" | 2 ++ "2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" | 2 ++ "3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" | 3 +++ demo.java | 0 4 files changed, 7 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 demo.java 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..e223ae1 --- /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 "yelion" +git config --global user.email "yelion.h@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..8c6e334 --- /dev/null +++ "b/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" @@ -0,0 +1,2 @@ +git branck 15 +git checkout 15 \ 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/demo.java b/demo.java new file mode 100644 index 0000000..e69de29 -- Gitee From 6d58ef1f95d98c8c863b9b145290a5fea3291d9d Mon Sep 17 00:00:00 2001 From: yelion Date: Mon, 2 Nov 2020 18:26:12 +0800 Subject: [PATCH 3/4] AutoPush --- "demo1/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" | 2 ++ "demo1/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" | 2 ++ "demo1/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" | 3 +++ demo1/demo1.java | 0 4 files changed, 7 insertions(+) create mode 100644 "demo1/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" create mode 100644 "demo1/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" create mode 100644 "demo1/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" create mode 100644 demo1/demo1.java diff --git "a/demo1/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" "b/demo1/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" new file mode 100644 index 0000000..e223ae1 --- /dev/null +++ "b/demo1/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" @@ -0,0 +1,2 @@ +git config --global user.name "yelion" +git config --global user.email "yelion.h@qq.com" \ No newline at end of file diff --git "a/demo1/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" "b/demo1/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" new file mode 100644 index 0000000..8c6e334 --- /dev/null +++ "b/demo1/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" @@ -0,0 +1,2 @@ +git branck 15 +git checkout 15 \ No newline at end of file diff --git "a/demo1/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" "b/demo1/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" new file mode 100644 index 0000000..0fbd52f --- /dev/null +++ "b/demo1/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/demo1/demo1.java b/demo1/demo1.java new file mode 100644 index 0000000..e69de29 -- Gitee From 3e3f89f9809868626800250b60500b0d2d278006 Mon Sep 17 00:00:00 2001 From: yelion Date: Wed, 4 Nov 2020 00:11:13 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E7=AE=80=E5=8D=95=E9=93=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...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 - demo1/demo1.java | 0 ...6\347\275\256\350\264\246\345\217\267.bat" | 0 ...7\346\215\242\345\210\206\346\224\257.bat" | 0 ...2\345\212\250\346\217\220\344\272\244.bat" | 0 src/datastruct/linklist/LinkList.java | 59 +++++++++++++++++++ src/datastruct/linklist/Node.java | 38 ++++++++++++ src/datastruct/linklist/TryToRun.java | 12 ++++ src/{ => demo}/LinkedList.java | 0 src/{ => demo}/Main.java | 0 src/{ => demo}/Node.java | 0 13 files changed, 109 insertions(+), 7 deletions(-) delete mode 100644 "demo1/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" delete mode 100644 "demo1/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" delete mode 100644 "demo1/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" delete mode 100644 demo1/demo1.java rename "1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" => "git_bat/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" (100%) rename "2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" => "git_bat/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" (100%) rename "3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" => "git_bat/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" (100%) create mode 100644 src/datastruct/linklist/LinkList.java create mode 100644 src/datastruct/linklist/Node.java create mode 100644 src/datastruct/linklist/TryToRun.java rename src/{ => demo}/LinkedList.java (100%) rename src/{ => demo}/Main.java (100%) rename src/{ => demo}/Node.java (100%) diff --git "a/demo1/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" "b/demo1/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" deleted file mode 100644 index e223ae1..0000000 --- "a/demo1/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" +++ /dev/null @@ -1,2 +0,0 @@ -git config --global user.name "yelion" -git config --global user.email "yelion.h@qq.com" \ No newline at end of file diff --git "a/demo1/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" "b/demo1/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" deleted file mode 100644 index 8c6e334..0000000 --- "a/demo1/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" +++ /dev/null @@ -1,2 +0,0 @@ -git branck 15 -git checkout 15 \ No newline at end of file diff --git "a/demo1/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" "b/demo1/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" deleted file mode 100644 index 0fbd52f..0000000 --- "a/demo1/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" +++ /dev/null @@ -1,3 +0,0 @@ -git add . -git commit -m "AutoPush" -git push \ No newline at end of file diff --git a/demo1/demo1.java b/demo1/demo1.java deleted file mode 100644 index e69de29..0000000 diff --git "a/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" "b/git_bat/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" similarity index 100% rename from "1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" rename to "git_bat/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" diff --git "a/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" "b/git_bat/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" similarity index 100% rename from "2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" rename to "git_bat/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" diff --git "a/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" "b/git_bat/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" similarity index 100% rename from "3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" rename to "git_bat/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" diff --git a/src/datastruct/linklist/LinkList.java b/src/datastruct/linklist/LinkList.java new file mode 100644 index 0000000..07d72b3 --- /dev/null +++ b/src/datastruct/linklist/LinkList.java @@ -0,0 +1,59 @@ +package datastruct.linklist; + +public class LinkList { + + private Node head; + + public void addToRear(Object data){ + Node node = new Node(data); + Node head = this.head; + while (true){ + if (head.getNext()==null){ + head.setNext(node); + System.out.println("尾部添加:" + head.toString()); + return; + } + } + } + + public void addToFront(Object data){ + Node node = new Node(data); + node.setNext(this.head); + this.head = node; + System.out.println("头部添加:" + head.toString()); + return; + } + + public void removeItem(Object object){ + Node head = this.head; + if (head.getData().equals(object)){ + this.head = head.getNext(); + System.out.println("已删除:" + head.toString()); + return; + } + while (true){ + if (head.getNext().getData().equals(object)){ + System.out.println("已删除:" + head.getNext()); + head.setNext(head.getNext().getNext()); + return; + } + head = head.getNext(); + } + } + + public LinkList(Object data) { + this.head = new Node(data); + } + + @Override + public String toString(){ + Node head = this.head; + StringBuilder printStr = new StringBuilder("链表:"); + while (head!=null){ + printStr.append(head.getData().toString()); + printStr.append(" --> "); + head = head.getNext(); + } + return printStr.toString(); + } +} diff --git a/src/datastruct/linklist/Node.java b/src/datastruct/linklist/Node.java new file mode 100644 index 0000000..2b0e955 --- /dev/null +++ b/src/datastruct/linklist/Node.java @@ -0,0 +1,38 @@ +package datastruct.linklist; + +public class Node { + private Object data; + private Node next; + + public Object getData() { + return data; + } + + public void setData(Object data) { + this.data = data; + } + + public Node getNext() { + return next; + } + + public void setNext(Node next) { + this.next = next; + } + + public Node(Object data) { + this.data = data; + } + + public Node(Object data, Node next) { + this.data = data; + this.next = next; + } + + @Override + public String toString() { + return "Node{" + + "data=" + data + + '}'; + } +} diff --git a/src/datastruct/linklist/TryToRun.java b/src/datastruct/linklist/TryToRun.java new file mode 100644 index 0000000..67d4d46 --- /dev/null +++ b/src/datastruct/linklist/TryToRun.java @@ -0,0 +1,12 @@ +package datastruct.linklist; + +public class TryToRun { + public static void main(String[] args) { + //没有多次测试,若有问题及时反馈 + LinkList linkList = new LinkList("a"); + linkList.addToRear("b"); + linkList.addToFront("c"); + linkList.removeItem("a"); + System.out.println(linkList.toString()); + } +} diff --git a/src/LinkedList.java b/src/demo/LinkedList.java similarity index 100% rename from src/LinkedList.java rename to src/demo/LinkedList.java diff --git a/src/Main.java b/src/demo/Main.java similarity index 100% rename from src/Main.java rename to src/demo/Main.java diff --git a/src/Node.java b/src/demo/Node.java similarity index 100% rename from src/Node.java rename to src/demo/Node.java -- Gitee