示例#1
0
 public double pop()
 {
     if(top != null)
     {
         double topValue = top.value;
         top = top.prev;
         count--;
         return topValue;
     }
     else
     {
         return 0.0;
     }
 }
示例#2
0
 // push, pop, peek, count
 public void push(double value)
 {
     if (head == null)
     {
         head = new Node(value, null);
         top = head;
         this.count++;
     }
     else
     {
         Node item = new Node(value, top);
         top = item;
         this.count++;
     }
 }
示例#3
0
 /// <summary>
 /// Full constructor that specifies values for all the members
 /// </summary>
 /// <param name="value"></param>
 /// <param name="prev"></param>
 public Node(double value, Node prev)
 {
     this.value = value;
     this.prev = prev;
 }