Beispiel #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;
 }
Beispiel #2
0
 public void push(int d)
 {
     Node item = new Node(d);
     item.next = top;
     top = item;
 }
Beispiel #3
0
 public int? pop()
 {
     if (top != null)
     {
         Node item = top;
         top = top.next;
         return item.data;
     }
     return null;
 }