Python 循环队列实现详解及代码示例
-
def pop(self):
-
assert not self.empty() #队列非空 -
self.front = (self.front + 1) % M -
return self.data[self.front] -
def getFront(self):
-
assert not self.empty() #队列非空 -
return self.data[(self.front+1) % M] -
def getSize(self):
-
return (self.rear - self.front + M) % M
原文地址: https://www.cveoy.top/t/topic/nzS2 著作权归作者所有。请勿转载和采集!