We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
void push(int node) { stackIn.push(node); } //不会导致队列顺序出错吗?
The text was updated successfully, but these errors were encountered:
stackIn模拟入队,stackOut模拟出队。因此出队的时候,先判断stackOut是否为空,如果为空,则将stackIn的所有数据压栈到stackOut,此时stackOut栈顶元素就是模拟队列的头元素;如果不为空,就直接将stackOut栈顶元素出栈。
Sorry, something went wrong.
No branches or pull requests
void push(int node) { stackIn.push(node); } //不会导致队列顺序出错吗?
The text was updated successfully, but these errors were encountered: