随笔分类 - 数据结构与算法 / 栈和队列
【LeetCode】232.使用栈模拟队列
摘要:使用栈模拟队列 请你仅使用两个栈实现先入先出队列。队列应当支持一般队列支持的所有操作(push、pop、peek、empty):实现 MyQueue 类: void push(int x) 将元素 x 推到队列的末尾 int pop() 从队列的开头移除并返回元素 int peek() 返回队列
【数据结构与算法】背包、队列和栈
摘要:前言 集合类数据类型的实现 1 栈 1.1 定容栈 /** * 定容栈的实现 * */ public class FixedCapacityStackOfStrings { private String[] a; private int N = 0; public FixedCapacityStac