課程
/后端開發
/C++
/數據結構探險之樹篇
為什么這個二叉樹只能到三層啊 ?我沒看懂啊 ?大神請教一下
2017-08-15
源自:數據結構探險之樹篇 6-6
正在回答
//確實有這個問題,只能循環到第三層,下邊是我修改的代碼 node*node::searchnode?(int?nodeindex) { if(this->index==nodeindex) { return?this; } if(this->plchild?!=NULL) {??? if(this->plchild->searchnode?(nodeindex)!=NULL) { return?this->plchild->searchnode?(nodeindex); } //if(this->plchild?->index==nodeindex) //{ //return?this->plchild?; //} } if(this->prchild?!=NULL) { if(this->prchild->searchnode?(nodeindex)!=NULL) { ? return?this->prchild->searchnode?(nodeindex); } //if(this->prchild?->index==nodeindex) //{ // return?this->prchild?; //} } return?NULL; }
舉報
樹,將為你開啟更精彩的數據結構大門,了解更多概念
1 回答樹轉換二叉樹??
1 回答創建二叉樹
2 回答打印二叉樹
1 回答二叉樹的數組實現
2 回答二叉樹源代碼有嗎?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2018-06-19