摘要: 队列也是一种线性结构,从一端(队尾)添加元素,从另一端(队首)取出元素 先进先出(First In First Out) 数组实现队列 常用方法为enqueue()、dequeue()、getFront()、getSize()、isEmpty() public class Algorithm { p 阅读全文
posted @ 2021-10-15 22:18 振袖秋枫问红叶 阅读(70) 评论(0) 推荐(0)
摘要: public class Algorithm { public static void main(String[] args) { MyCircularQueue queue = new MyCircularQueue(5); for (int i = 0; i < 6; i++) { System 阅读全文
posted @ 2021-10-15 15:13 振袖秋枫问红叶 阅读(28) 评论(0) 推荐(0)
摘要: import java.util.ArrayList; import java.util.List; class Solution { public List<String> buildArray(int[] target, int n) { List<String> list = new Arra 阅读全文
posted @ 2021-10-15 14:25 振袖秋枫问红叶 阅读(31) 评论(0) 推荐(0)
摘要: 辅助栈实现 import java.util.Stack; class CustomStack { Stack<Integer> stack; int maxSize; public CustomStack(int maxSize) { stack = new Stack(); this.maxSi 阅读全文
posted @ 2021-10-15 13:24 振袖秋枫问红叶 阅读(35) 评论(0) 推荐(0)
摘要: 辅助栈 import java.util.Stack; class MinStack { Stack<Integer> stack; Stack<Integer> minStack; public MinStack() { stack = new Stack<>(); minStack = new 阅读全文
posted @ 2021-10-15 10:42 振袖秋枫问红叶 阅读(37) 评论(0) 推荐(0)