树的遍历

1.前序遍历法

数据结构:stack栈

操作:

stack<Node*>st;

st.top();

st.pop();

st.emplace();

2.层次遍历法

数据结构:queue队列

操作:

queue<Node*>q;

q.front();

q.pop();

q.push();

posted @ 2023-04-06 19:13  iu本u  阅读(4)  评论(0)    收藏  举报