Exemplo n.º 1
0
        /// <summary>
        /// Splits the queue into three subqueues. The first one contains all values
        /// with priority less than <paramref cref="priority"/>, the second one all values
        /// with equal priority, and the third one values with greater priorities.
        /// </summary>
        /// <param name="priority">The priority.</param>
        /// <remarks>O(log(m)), where m is the number of elements from the closer side of
        /// the queue to the position of the priority.</remarks>
        public Tuple <PriorityQueue <T, TPriority>, PriorityQueue <T, TPriority>, PriorityQueue <T, TPriority> > ExtractAll(TPriority priority)
        {
            var triple = _ft.ExtractAll(priority);

            return(Tuple.New(
                       new PriorityQueue <T, TPriority>(triple.Item1),
                       new PriorityQueue <T, TPriority>(triple.Item2),
                       new PriorityQueue <T, TPriority>(triple.Item3)));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Splits the sequence into three subsequences. The first one contains all
        /// elements less than <paramref cref="item"/>, the second one all elements equal
        /// to it, and the third one greater elements.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <remarks>O(log(m)), where m is the number of elements from the closer side of
        /// the sequence to the position of the item.</remarks>
        public Tuple <OrderedSequence <T>, OrderedSequence <T>, OrderedSequence <T> > ExtractAll(T item)
        {
            var triple = _ft.ExtractAll(item);

            return(Tuple.New(
                       new OrderedSequence <T>(triple.Item1),
                       new OrderedSequence <T>(triple.Item2),
                       new OrderedSequence <T>(triple.Item3)));
        }