Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bf8b2e7

Browse files
committed
(draft step, to squash) Add initial implementation
This commit adds the core of the heap implementation for the priority queue. It doesn't implement the method `EnqueueDequeue`, as I'm not convinced by it. It also doesn't implement the method `CopyTo(Array array, int index)`, leaving this one for later.
1 parent dda9697 commit bf8b2e7

File tree

2 files changed

+393
-57
lines changed

2 files changed

+393
-57
lines changed

src/libraries/System.Collections/ref/System.Collections.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ public partial class PriorityQueue<TElement, TPriority>
383383
{
384384
public PriorityQueue() { }
385385
public PriorityQueue(System.Collections.Generic.IComparer<TPriority>? comparer) { }
386-
public PriorityQueue(System.Collections.Generic.IEnumerable<(TElement element, TPriority priority)> values) { }
387-
public PriorityQueue(System.Collections.Generic.IEnumerable<(TElement element, TPriority priority)> values, System.Collections.Generic.IComparer<TPriority>? comparer) { }
386+
public PriorityQueue(System.Collections.Generic.IEnumerable<(TElement element, TPriority priority)> items) { }
387+
public PriorityQueue(System.Collections.Generic.IEnumerable<(TElement element, TPriority priority)> items, System.Collections.Generic.IComparer<TPriority>? comparer) { }
388388
public PriorityQueue(int initialCapacity) { }
389389
public PriorityQueue(int initialCapacity, System.Collections.Generic.IComparer<TPriority>? comparer) { }
390390
public System.Collections.Generic.IComparer<TPriority> Comparer { get { throw null; } }
@@ -394,16 +394,16 @@ public void Clear() { }
394394
public TElement Dequeue() { throw null; }
395395
public void Enqueue(TElement element, TPriority priority) { }
396396
public TElement EnqueueDequeue(TElement element, TPriority priority) { throw null; }
397-
public void EnqueueRange(System.Collections.Generic.IEnumerable<(TElement element, TPriority priority)> values) { }
398-
public void EnqueueRange(System.Collections.Generic.IEnumerable<TElement> values, TPriority priority) { }
397+
public void EnqueueRange(System.Collections.Generic.IEnumerable<(TElement element, TPriority priority)> items) { }
398+
public void EnqueueRange(System.Collections.Generic.IEnumerable<TElement> elements, TPriority priority) { }
399399
public void EnsureCapacity(int capacity) { }
400400
public TElement Peek() { throw null; }
401401
public void TrimExcess() { }
402402
public bool TryDequeue([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TElement element, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TPriority priority) { throw null; }
403403
public bool TryPeek([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TElement element, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TPriority priority) { throw null; }
404404
public partial class UnorderedItemsCollection : System.Collections.Generic.IEnumerable<(TElement element, TPriority priority)>, System.Collections.Generic.IReadOnlyCollection<(TElement element, TPriority priority)>, System.Collections.ICollection, System.Collections.IEnumerable
405405
{
406-
public UnorderedItemsCollection() { }
406+
public UnorderedItemsCollection(IReadOnlyCollection<(TElement element, TPriority priority)> items) { }
407407
public int Count { get { throw null; } }
408408
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
409409
object System.Collections.ICollection.SyncRoot { get { throw null; } }

0 commit comments

Comments
 (0)