len function

This commit is contained in:
Josh Baker 2017-05-01 13:16:32 -07:00
parent fc4cef0a81
commit 1feaf062ef
1 changed files with 3 additions and 1 deletions

View File

@ -46,7 +46,9 @@ func (q *Queue) Peek() Item {
} }
return q.data[0] return q.data[0]
} }
func (q *Queue) Len() int {
return q.length
}
func (q *Queue) down(pos int) { func (q *Queue) down(pos int) {
data := q.data data := q.data
halfLength := q.length >> 1 halfLength := q.length >> 1