循环队列-入队
//入队
public bool EnQueue(T element) {
    if (this.isFull()) {
        Console.WriteLine("队列已满!");
        return false;
    }

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


队尾指标再到达数组最后面的时候,需要从头来过


首页 我的博客
粤ICP备17103704号