Skip to content

Commit 3ba0f68

Browse files
ESunESun
authored andcommitted
A New Branch
1 parent d4a25d6 commit 3ba0f68

File tree

11 files changed

+208
-0
lines changed

11 files changed

+208
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5+
<classpathentry kind="output" path="bin"/>
6+
</classpath>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>617187912Learning</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package com.coding.basic;
2+
3+
import java.util.Arrays;
4+
5+
public class ArrayList implements List {
6+
7+
private int size = 0;
8+
9+
private Object[] elementData = new Object[100];
10+
11+
public void add(Object o){
12+
if (size>=elementData.length){
13+
elementData = Arrays.copyOf(elementData, elementData.length * 2);
14+
}
15+
elementData[size] = o;
16+
size+=1;
17+
}
18+
public void add(int index, Object o){
19+
if (size>=elementData.length){
20+
elementData = Arrays.copyOf(elementData, elementData.length * 2);
21+
}
22+
System.arraycopy(elementData, index,
23+
elementData, index+1, size-index);
24+
elementData[index]=o;
25+
size+=1;
26+
}
27+
28+
public Object get(int index){
29+
return elementData[index];
30+
}
31+
32+
public Object remove(int index){
33+
System.arraycopy(elementData, index+1,
34+
elementData, index, size-index);
35+
size-=1;
36+
return elementData;
37+
}
38+
39+
public int size(){
40+
return size;
41+
}
42+
43+
public Iterator iterator(){
44+
return null;
45+
}
46+
47+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.coding.basic;
2+
3+
public class BinaryTreeNode {
4+
5+
private Object data;
6+
private BinaryTreeNode left;
7+
private BinaryTreeNode right;
8+
9+
public Object getData() {
10+
return data;
11+
}
12+
public void setData(Object data) {
13+
this.data = data;
14+
}
15+
public BinaryTreeNode getLeft() {
16+
return left;
17+
}
18+
public void setLeft(BinaryTreeNode left) {
19+
this.left = left;
20+
}
21+
public BinaryTreeNode getRight() {
22+
return right;
23+
}
24+
public void setRight(BinaryTreeNode right) {
25+
this.right = right;
26+
}
27+
28+
public BinaryTreeNode insert(Object o){
29+
return null;
30+
}
31+
32+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.coding.basic;
2+
3+
public interface Iterator {
4+
public boolean hasNext();
5+
public Object next();
6+
7+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package com.coding.basic;
2+
3+
public class LinkedList implements List {
4+
5+
private Node head;
6+
7+
public void add(Object o){
8+
9+
}
10+
public void add(int index , Object o){
11+
12+
}
13+
public Object get(int index){
14+
return null;
15+
}
16+
public Object remove(int index){
17+
return null;
18+
}
19+
20+
public int size(){
21+
return -1;
22+
}
23+
24+
public void addFirst(Object o){
25+
26+
}
27+
public void addLast(Object o){
28+
29+
}
30+
public Object removeFirst(){
31+
return null;
32+
}
33+
public Object removeLast(){
34+
return null;
35+
}
36+
public Iterator iterator(){
37+
return null;
38+
}
39+
40+
41+
private static class Node{
42+
Object data;
43+
Node next;
44+
45+
}
46+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.coding.basic;
2+
3+
public interface List {
4+
public void add(Object o);
5+
public void add(int index, Object o);
6+
public Object get(int index);
7+
public Object remove(int index);
8+
public int size();
9+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.coding.basic;
2+
3+
public class Queue {
4+
5+
public void enQueue(Object o){
6+
}
7+
8+
public Object deQueue(){
9+
return null;
10+
}
11+
12+
public boolean isEmpty(){
13+
return false;
14+
}
15+
16+
public int size(){
17+
return -1;
18+
}
19+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.coding.basic;
2+
3+
public class Stack {
4+
private ArrayList elementData = new ArrayList();
5+
6+
public void push(Object o){
7+
}
8+
9+
public Object pop(){
10+
return null;
11+
}
12+
13+
public Object peek(){
14+
return null;
15+
}
16+
public boolean isEmpty(){
17+
return false;
18+
}
19+
public int size(){
20+
return -1;
21+
}
22+
}

0 commit comments

Comments
 (0)