2014年3月22日

Gray Code

摘要: 1 //reference http://blog.csdn.net/fightforyourdream/article/details/14517973 2 vector grayCode(int n) { 3 vector codes; 4 if(n>1;11 codes.push_back(tmp);12 }13 return codes;14 } 阅读全文

posted @ 2014-03-22 17:35 crane_practice 阅读(125) 评论(0) 推荐(0) 编辑

Populating Next Right Pointers in Each Node II ?

摘要: 1 void connect(TreeLinkNode *root) { 2 if(root==NULL) 3 return; 4 if(root->left&&root->right) 5 root->left->next=root->right; 6 if(root->next){ 7 if(root->left!=NULL&&root->right==NULL){ 8 if(root->next->left) 9 ... 阅读全文

posted @ 2014-03-22 11:59 crane_practice 阅读(158) 评论(0) 推荐(0) 编辑

Populating Next Right Pointers in Each Node

摘要: 1 //按说层次遍历最方便了,但是空间复杂度不满足题意 2 //遍历吧,可是像例子中的,5—>6怎么实现呢 3 //You may assume that it is a perfect binary tree (ie, all leaves are at the same level, and every parent has two children). 4 //这个提示是什么意思? 5 void connect(TreeLinkNode *root) { 6 if(root==NULL) 7 return;... 阅读全文

posted @ 2014-03-22 10:51 crane_practice 阅读(199) 评论(0) 推荐(0) 编辑

导航