1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-03-01 00:35:28 +08:00

feat: add Size func for PriorityQueue

This commit is contained in:
dudaodong
2022-06-05 17:29:36 +08:00
parent 61251fb0f1
commit a706d488e6
3 changed files with 628 additions and 0 deletions
+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