feat: add Size func for PriorityQueue

This commit is contained in:
dudaodong committed 2022-06-05 17:29:36 +08:00
1 parent 61251fb0f1
commit a706d488e6
3 files changed
+628

No files matched your search

+5
View File
@@ -29,6 +29,11 @@ func (q *PriorityQueue[T]) IsEmpty() bool {
return q.size == 0
}
// Size get number of items in the queue
func (q *PriorityQueue[T]) Size() int {
return q.size
}
// IsFull checks if the queue capacity is full or not
func (q *PriorityQueue[T]) IsFull() bool {
return q.size == len(q.items)-1