循环队列-出队
//出队
public bool DeQueue(ref T element) {
    if (this.isEmpty()) {
        Console.WriteLine("队列为空!");
        return false;
    }

    element = this._data[this._front];
    //指标向前移动
    this._front = (this._front + 1) % (this._maxLength + 1);
    return true;
}


队头指标向后移,同样需要注意队头指标超过数组下标,需要回到数组开头的情况


首页 我的博客
粤ICP备17103704号