예제 #1
0
 public PriorityQueue(IEnumerable <T> items)
 {
     foreach (T t in items)
     {
         _treeRep = _treeRep.PushBack(new CompElement <T>(t));
     }
 }
예제 #2
0
        public OrderedSequence <T, M> PushBack(OrderedElement <T, M> ordEl)
        {
            ViewR <OrderedElement <T, M>, M> viewR = _tree.RightView();

            if (viewR != null)
            {
                if (viewR.last.Measure()
                    .CompareTo(ordEl.Measure())
                    > 0)
                {
                    throw new Exception(
                              "OrderedSequence Error: PushBack() of an element less than the biggest seq el."
                              );
                }
            }
            //else
            return(new OrderedSequence <T, M>(_key, _tree.PushBack(ordEl)));
        }