fix bug for commit 5eae708 (#317)

This commit is contained in:
sjinzh
2023-02-01 21:13:30 +08:00
committed by GitHub
parent ad8859502c
commit 6cd6d5589e
3 changed files with 7 additions and 7 deletions

View File

@ -60,7 +60,7 @@ pub fn ArrayQueue(comptime T: type) type {
var rear = (self.front + self.queSize) % self.capacity();
// 尾结点后添加 num
self.nums[rear] = num;
self.queSize++;
self.queSize += 1;
}
// 出队
@ -68,7 +68,7 @@ pub fn ArrayQueue(comptime T: type) type {
var num = self.peek();
// 队首指针向后移动一位,若越过尾部则返回到数组头部
self.front = (self.front + 1) % self.capacity();
self.queSize--;
self.queSize -= 1;
return num;
}