Merge branch 'youngyangyang04:master' into master

This commit is contained in:
AsaoOoo0o0o
2025-04-21 16:57:51 +08:00
committed by GitHub
289 changed files with 2139 additions and 3366 deletions

View File

@@ -1,8 +1,6 @@
<p align="center">
<a href="https://www.programmercarl.com/xunlian/xunlianying.html" target="_blank">
<img src="../pics/训练营.png" width="1000"/>
</a>
<p align="center"><strong><a href="./qita/join.md">参与本项目</a>,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!</strong></p>
* [做项目多个C++、Java、Go、测开、前端项目](https://www.programmercarl.com/other/kstar.html)
* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html)
* [背八股40天挑战高频面试题](https://www.programmercarl.com/xunlian/bagu.html)
> 来看看栈和队列不为人知的一面
@@ -13,7 +11,7 @@
如图所示:
![栈与队列理论1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104235346563.png)
![栈与队列理论1](https://file.kamacoder.com/pics/20210104235346563.png)
那么我这里再列出四个关于栈的问题大家可以思考一下。以下是以C++为例,使用其他编程语言的同学也对应思考一下,自己使用的编程语言里栈和队列是什么样的。
@@ -48,7 +46,7 @@ C++标准库是有多个版本的要知道我们使用的STL是哪个版本
来说一说栈,栈先进后出,如图所示:
![栈与队列理论2](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104235434905.png)
![栈与队列理论2](https://file.kamacoder.com/pics/20210104235434905.png)
栈提供push 和 pop 等等接口,所有元素必须符合先进后出规则,所以栈不提供走访功能,也不提供迭代器(iterator)。 不像是set 或者map 提供迭代器iterator来遍历所有元素。
@@ -61,7 +59,7 @@ C++标准库是有多个版本的要知道我们使用的STL是哪个版本
从下图中可以看出栈的内部结构栈的底层实现可以是vectordequelist 都是可以的, 主要就是数组和链表的底层实现。
![栈与队列理论3](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104235459376.png)
![栈与队列理论3](https://file.kamacoder.com/pics/20210104235459376.png)
**我们常用的SGI STL如果没有指定底层实现的话默认是以deque为缺省情况下栈的底层结构。**
@@ -93,7 +91,3 @@ std::queue<int, std::list<int>> third; // 定义以list为底层容器的队列
<p align="center">
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a>