标签:roo leetcode null size front queue lin link ext
if(root == NULL) return; queue<TreeLinkNode *> que; que.push(root); while(!empty(que)){ int lens = que.size(); for(int i=0;i < lens-1;i++){ TreeLinkNode *temp = que.front(); que.pop(); temp->next = que.front(); if(temp->left) que.push(temp->left); if(temp->right) que.push(temp->right); } TreeLinkNode *temp2 = que.front(); temp2->next = NULL; que.pop(); if(temp2->left) que.push(temp2->left); if(temp2->right) que.push(temp2->right); }
_
标签:roo leetcode null size front queue lin link ext
原文地址:https://www.cnblogs.com/cunyusup/p/10353522.html