判斷兩棵樹是否同構

同構 就是結構相同 數據域不管 每個結點度相同 下圖2棵樹是同構的 但是如果左邊的樹加了紅色結點,則不同構 思路:二叉樹序列化 也可以參考下面的鏈接 http://www.javashuo.com/article/p-ncofffqi-qg.html #include <iostream> #include <string> using namespace std; struct btnode {
相關文章
相關標籤/搜索