如何使用两个堆栈实现队列_使用两个堆栈实现队列

如何使用两个堆栈实现队列

Queue:

队列:

A queue is a data structure for storing data where the order in which data arrives is important. The queue is implemented as FIFO (First in First Out).

队列是用于存储数据的数据结构,数据到达的顺序很重要。 该队列被实现为FIFO(先进先出)。

The queue is an ordered list in which insertions are done at one end (rear) and deletions are done from another end (front). The first element that got inserted is the first one to be deleted (basic principle of FIFO).

队列是一个有序列表,其中插入是在一端(后部)完成,而删除是从另一端(前部)完成。 插入的第一个元素是要删除的第一个元素(FIFO的基本原理)。

The main Queue operations are:

队列的主要操作是:

  1. EnQueue (int data): Insertion at rear end

    EnQueue(int数据):在后端插入

  2. int DeQueue(): Deletion from front end

    int DeQueue():从前端删除

Stack:

堆栈:

A stack is also another data structure which is implemented as LIFO.

堆栈也是另一个实现为LIFO的数据结构。

The stack is an ordered list where insertion and deletion are done from the same end, top. The last element that entered first is the first one to be deleted (the basic principle behind the LIFO).

堆栈是一个有序列表,其中插入和删除从同一末端开始。 首先输入的最后一个元素是要删除的第一个元素(LIFO的基本原理)。

The main stack operations are:

主要的堆栈操作是:

    • 0
      点赞
    • 1
      收藏
      觉得还不错? 一键收藏
    • 0
      评论
    评论
    添加红包

    请填写红包祝福语或标题

    红包个数最小为10个

    红包金额最低5元

    当前余额3.43前往充值 >
    需支付:10.00
    成就一亿技术人!
    领取后你会自动成为博主和红包主的粉丝 规则
    hope_wisdom
    发出的红包
    实付
    使用余额支付
    点击重新获取
    扫码支付
    钱包余额 0

    抵扣说明:

    1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
    2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

    余额充值