Example #1
0
 public PointValueList()
 {
     Count = 0;
     _first = null;
 }
Example #2
0
        public bool AddValue(double value)
        {
            var newNode = new LLNode(value);
            if (_first == null) {
                _first = newNode;
                Count = 1;
                return true;
            }

            if (value < _first.Value) {
                newNode.Next = _first;
                _first = newNode;
                Count++;
                return true;
            }

            var temp = _first;
            var prev = temp;
            while (temp != null && value > temp.Value) {
                prev = temp;
                temp = temp.Next;
            }
            newNode.Next = prev.Next;
            prev.Next = newNode;

            Count++;

            return true;
        }
 public PointValueList()
 {
     Count  = 0;
     _first = null;
 }