public class DLinkedList {
private DListNode head, tail;
public DLinkedList(){
}
public void insertFirst(String x){
}
public void insertLast(String x) {
DListNode newNode = new DListNode(x);
DListNode p = head;
if (head == null) {
head = newNode;
tail = newNode;
return;
}
while(p.rlink != null) {
p = p.rlink;
}
p.rlink = newNode;
newNode.llink = p;
tail = newNode;
}
public String deleteFirst() {
String x = " ";
if (head == null) {
return "No element";
}
x = head.data;
head = head.rlink;
head.llink = null;
if (head == null) { tail = null; }
return x;
}
public String deleteLast(){
}
public int findData(String x){ //Z가 몇 번째 데이터인지를 반환하는 메소드
}
public void deleteNode(String y){ // 원소 y 삭제
}
public void printList(){
DListNode p;
p=head;
System.out.print("(");
while(p!=null){
System.out.print(p.data);
p=p.rlink;
if(p!=null){
System.out.print(", ");
}
}
System.out.println(")");
}
}
진짜 쪼금 남음
대다네
https://github.com/samchon/tstl/blob/master/src/base/container/ListContainer.ts
봐도 몰겠음