Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ajax] 23.栈和队列的区别? #84

Open
qiilee opened this issue Sep 29, 2019 · 0 comments
Open

[ajax] 23.栈和队列的区别? #84

qiilee opened this issue Sep 29, 2019 · 0 comments
Labels

Comments

@qiilee
Copy link
Member

qiilee commented Sep 29, 2019

答案:

  • 栈的插入和删除操作都是在一端进行的,而队列的操作却是在两端进行的。
  • 队列先进先出,栈先进后出。
  • 栈只允许在表尾一端进行插入和删除,而队列只允许在表尾一端进行插入,在表头一端进行删除

拓展:

栈和堆的区别?

栈区(stack)—    由编译器自动分配释放,存放函数的参数值,局部变量的值等。

堆区(heap)—    一般由程序员分配释放,若程序员不释放,程序结束时可能由 OS 回收。

堆(数据结构):堆可以被看成是一棵树,如:堆排序;

栈(数据结构):一种先进后出的数据结构。

@qiilee qiilee added the Ajax label Sep 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant