国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

1102. Invert a Binary Tree (25) PAT甲級

2019-11-14 09:55:08
字體:
供稿:網(wǎng)友

傳送門

#include<stdio.h>#include<queue>#include<string.h>#include<stack>using namespace std;#define MAX_N 37int n;struct Node{ int lchild,rchild;}node[MAX_N];bool visited[MAX_N]={false};int strTonum(char c){ if(c=='-') return -1; visited[c-'0']=true; return c-'0';}void reverse(int root){ if(root==-1) return; reverse(node[root].lchild); reverse(node[root].rchild); int temp=node[root].lchild; node[root].lchild=node[root].rchild; node[root].rchild=temp;}void level(int root){ int count=0; queue<int> q; q.push(root); while(!q.empty()){ int p=q.front(); q.pop(); count++;
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 丹江口市| 桦甸市| 永康市| 乐平市| 郑州市| 和田市| 临沧市| 新竹县| 九台市| 潍坊市| 巴里| 大洼县| 西华县| 汉沽区| 海城市| 枣庄市| 桃江县| 河曲县| 屏山县| 体育| 鹤庆县| 新兴县| 长子县| 三门县| 仙居县| 禄丰县| 灵川县| 永德县| 黄平县| 历史| 内丘县| 辰溪县| 钟山县| 嘉禾县| 武清区| 枣庄市| 庆云县| 喜德县| 新源县| 抚远县| 濮阳县|