春节7天练 | Day 2:栈、队列和递归
<p><img src="https://static001.geekbang.org/resource/image/d9/08/d90b8c83b0b6bb39214ac8e9b2537808.jpg" alt="" /></p>
<div class="_1kh1ihh6_0">
你好,我是王争。初二好!
为了帮你巩固所学,真正掌握数据结构和算法,我整理了数据结构和算法中,必知必会的 30 个代码实现,分 7 天发布出来,供你复习巩固所用。今天是第二篇。
和昨天一样,你可以花一点时间,来完成测验。测验完成后,你可以根据结果,回到相应章节,有针对性地进行复习。
* * *
## 关于栈、队列和递归的几个必知必会的代码实现
### 栈
* 用数组实现一个顺序栈
* 用链表实现一个链式栈
* 编程模拟实现一个浏览器的前进、后退功能
### 队列
* 用数组实现一个顺序队列
* 用链表实现一个链式队列
* 实现一个循环队列
### 递归
* 编程实现斐波那契数列求值 f(n)=f(n-1)+f(n-2)
* 编程实现求阶乘 n!
* 编程实现一组数据集合的全排列
## 对应的 LeetCode 练习题(@Smallfly 整理)
### 栈
* Valid Parentheses(有效的括号)
英文版:[https://leetcode.com/problems/valid-parentheses/](https://leetcode.com/problems/valid-parentheses/)
中文版:[https://leetcode-cn.com/problems/valid-parentheses/](https://leetcode-cn.com/problems/valid-parentheses/)
* Longest Valid Parentheses(最长有效的括号)
英文版:[https://leetcode.com/problems/longest-valid-parentheses/](https://leetcode.com/problems/longest-valid-parentheses/)
<!-- [[[read_end]]] -->
中文版:[https://leetcode-cn.com/problems/longest-valid-parentheses/](https://leetcode-cn.com/problems/longest-valid-parentheses/)
* Evaluate Reverse Polish Notatio(逆波兰表达式求值)
英文版:[https://leetcode.com/problems/evaluate-reverse-polish-notation/](https://leetcode.com/problems/evaluate-reverse-polish-notation/)
中文版:[https://leetcode-cn.com/problems/evaluate-reverse-polish-notation/](https://leetcode-cn.com/problems/evaluate-reverse-polish-notation/)
### 队列
* Design Circular Deque(设计一个双端队列)
英文版:[https://leetcode.com/problems/design-circular-deque/](https://leetcode.com/problems/design-circular-deque/)
中文版:[https://leetcode-cn.com/problems/design-circular-deque/](https://leetcode-cn.com/problems/design-circular-deque/)
* Sliding Window Maximum(滑动窗口最大值)
英文版:[https://leetcode.com/problems/sliding-window-maximum/](https://leetcode.com/problems/sliding-window-maximum/)
中文版:[https://leetcode-cn.com/problems/sliding-window-maximum/](https://leetcode-cn.com/problems/sliding-window-maximum/)
### 递归
* Climbing Stairs(爬楼梯)
英文版:[https://leetcode.com/problems/climbing-stairs/](https://leetcode.com/problems/climbing-stairs/)
中文版:[https://leetcode-cn.com/problems/climbing-stairs/](https://leetcode-cn.com/problems/climbing-stairs/)
* * *
昨天的第一篇,是关于数组和链表的,如果你错过了,点击文末的“<font color="orange">上一篇</font>”,即可进入测试。
祝你取得好成绩!明天见!