标签:
1 void exchange( struct node* node){ 2 struct node* tnode = node; 3 struct node* tmp = NULL; 4 5 if(node == NULL) 6 return; 7 8 while(1){ 9 tmp = tnode-> left; 10 tnode-> left = tnode->right ; 11 tnode-> right = tmp; 12 13 if(tnode->right ){ 14 push(tnode-> right); 15 } 16 17 if(tnode->left ){ 18 tnode = tnode->left; 19 } 20 else{ 21 if(!empty()){ 22 tnode = top(); 23 pop(); 24 } 25 else{ 26 break; 27 } 28 } 29 } 30 }
标签:
原文地址:http://www.cnblogs.com/zpfcode/p/5185052.html