加入收藏 | 设为首页 | 会员中心 | 我要投稿 焦作站长网 (https://www.0391zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 安全 > 正文

算法系列15天速成 第九天 队列

发布时间:2020-03-14 19:10:13 所属栏目:安全 来源:站长网
导读:可能大家都知道,线性表的变种非常非常多,比如今天讲的“队列”,灰常有意思啊

#region 获取队头元素
        /// <summary>
/// 获取队头元素
/// </summary>
/// <typeparam></typeparam>
/// <param></param>
/// <returns></returns>
        public T SeqQueuePeek<T>(SeqQueue<T> seqQueue)
        {
            if (SeqQueueIsEmpty(seqQueue))
                throw new Exception("队列已空,不能进行出队操作");

return seqQueue.data[seqQueue.head];
        }
        #endregion

#region 获取队列长度
        /// <summary>
/// 获取队列长度
/// </summary>
/// <typeparam></typeparam>
/// <param></param>
/// <returns></returns>
        public int SeqQueueLen<T>(SeqQueue<T> seqQueue)
        {
            return seqQueue.size;
        }
        #endregion
    }
    #endregion
}



(编辑:焦作站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读