예제 #1
0
 public void appendToTail(int d)
 {
     Node end = new Node(d);
     Node n = this;
     while (n.next != null)
     {
         n = n.next;
     }
     n.next = end;
 }
예제 #2
0
 public void push(int d)
 {
     Node item = new Node(d);
     item.next = top;
     top = item;
 }
예제 #3
0
 public int? pop()
 {
     if (top != null)
     {
         Node item = top;
         top = top.next;
         return item.data;
     }
     return null;
 }