
各类知识点
talak
这个作者很懒,什么都没留下…
展开
-
a^n % k 的logn 的算法
long long Cal ( long long a, long long n, long long k ) { if ( !a ) //如果a == 0 值为0 return 0; int r = 1; //当前余数r while ( n-- ) { if ( n & 1 )原创 2012-05-25 22:18:15 · 748 阅读 · 0 评论 -
遍历二叉树
//啥都不说 贴代码#include#include#include #include int len;char b[10000];typedef struct node{ char c; struct node *left; struct node *right;}Tnode;Tnode *insert(Tnode *a,int n){ i原创 2012-05-25 22:15:33 · 329 阅读 · 0 评论 -
公式之类的
错排公式M(n)=(n-1)[M(n-2)+M(n-1)]卡特兰数:h(n)=h(n-1)*(4*n-2)/(n+1); 递推关系的解为: h(n)=C(2n,n)/(n+1) (n=1,2,3,...)【此处正确,请勿擅改】 递推关系的另类解为: h(n)=c(2n,n)-c(2n,n+1)(n=1,2,3,...)原创 2012-05-25 22:36:19 · 338 阅读 · 0 评论 -
位运算学习
去掉最后一位 | (101101->10110) | x >> 1 在最后加一个0 | (101101->1011010) | x << 1 在最后加一个1 | (101101->1011011) | (x << 1) + 1 把最后一位变成1 |转载 2012-09-16 22:43:43 · 387 阅读 · 0 评论