Core/CafeLib.Core.Collections/Heaps/BinaryHeap.cs
/// <summary>
/// Add keyed item into the binary heap and allow duplicates.
/// Allow duplicates.
/// </summary>
/// <param name="item">item to add to heap.</param>
Add keyed item into the binary heap and allow duplicates.
Allow duplicates.
Add keyed item into the binary heap and allow duplicates . Allow duplicates .
public void Add(T item)
        {
            lock (HeapLock.Mutex)
            {
                int slot = _list.Count;
                _list.Add(item);
                while (slot > 1 && _comparison * item.CompareTo(_list[slot / 2]) > 0)
                {
                    _list[slot] = _list[slot / 2];
                    slot /= 2;
                }
                _list[slot] = item;
            }
        }
public void Add ( T item ) { lock ( HeapLock . Mutex ) { int slot = _list . Count ; _list . Add ( item ) ; while ( slot > 1 && _comparison * item . CompareTo ( _list [ slot / 2 ] ) > 0 ) { _list [ slot ] = _list [ slot / 2 ] ; slot /= 2 ; } _list [ slot ] = item ; } }
Add keyed item into the binary heap and allow duplicates.
Add keyed item into the binary heap and allow duplicates .
// Percolate up
item
T
item to add to heap.
item to add to heap .