Skip to content

Instantly share code, notes, and snippets.

@eiriktsarpalis
Forked from safern/PriorityQueue.cs
Last active September 22, 2020 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eiriktsarpalis/45d42f31f765a75bfd45f9487f9ed4e6 to your computer and use it in GitHub Desktop.
Save eiriktsarpalis/45d42f31f765a75bfd45f9487f9ed4e6 to your computer and use it in GitHub Desktop.
PriorityQueue api surface
namespace System.Collections.Generic
{
class PriorityQueue<TElement, TPriority> : IReadOnlyCollection<(TElement Element, TPriority Priority)>
{
#region Constructors
public PriorityQueue() { }
public PriorityQueue(IComparer<TPriority> comparer) { }
public PriorityQueue(IEnumerable<(TElement Element, TPriority Priority)> values) { }
public PriorityQueue(IEnumerable<(TElement Element, TPriority Priority)> values, IComparer<TPriority> comparer) { }
#endregion
#region Specific APIs
public IComparer<TPriority> Comparer { get { throw null; } }
public TElement Dequeue() { throw null; }
public void Enqueue(TElement item, TPriority priority) { }
public TElement Peek() { throw null; }
public bool TryDequeue(out TElement item) { throw null; }
public bool TryPeek(out TElement item) { throw null; }
#endregion
#region IReadOnlyCollection
public int Count { get { throw null; } }
public IEnumerator GetEnumerator() { throw null; }
#endregion
#region Enumerator
public struct Enumerator : IEnumerator<(TElement Element, TPriority Priority)>, IEnumerator, IDisposable
{
public (TElement Element, TPriority Priority) Current { get { throw null; } }
object System.Collections.IEnumerator.Current { get { throw null; } }
public void Dispose() { }
public bool MoveNext() { throw null; }
void System.Collections.IEnumerator.Reset() { }
}
#endregion
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment