-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinkedList.java
More file actions
40 lines (34 loc) · 1005 Bytes
/
Copy pathLinkedList.java
File metadata and controls
40 lines (34 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package xyz.squig;
import java.util.*;
public class LinkedList {
Node head;
public LinkedList() {
head = null;
}
public void addNode(int x, int y, int squareRank) {
Node newNode = new Node(x, y, squareRank);
newNode.next = head;
head = newNode;
}
public Vector<Integer> returnVector() {
Node temp = head;
Vector<Integer> moveVector = new Vector<Integer>();
while (temp != null){
moveVector.addElement(temp.x);
moveVector.addElement(temp.y);
temp = temp.next;
}
return moveVector;
}
public Vector<Integer> returnWeightedVector() {
Node temp = head;
Vector<Integer> moveVector = new Vector<Integer>();
while (temp != null){
moveVector.addElement(temp.x);
moveVector.addElement(temp.y);
moveVector.addElement(temp.squareRank);
temp = temp.next;
}
return moveVector;
}
}