数据结构 C/C++
文章平均质量分 79
__简言
如能忘掉渴望 岁月长 衣裳薄
展开
-
用位运算实现两个整数的加减乘除
#include #include using namespace std; int AddUonRecursive(int a,int b){ // 非递归加法 for(int i=1; i; i<<=1) if(b&i) for(int j=i; j; j<<=1) if(a&j) a &= ~j; else { a |= j;break; } retur原创 2012-10-24 21:32:03 · 1989 阅读 · 0 评论 -
二叉树的前序、中序、后序遍历
一、使用指针 /* *二叉树的前序、中序、后序遍历 */ #include #include #include #include using namespace std; typedef int ElemType; typedef struct treeT{ ElemType key; struct treeT* left; struct treeT* right; }*原创 2012-06-17 20:57:27 · 648 阅读 · 0 评论