
算法
w1964332
这个作者很懒,什么都没留下…
展开
-
alogorithm: random walk and a knight's tour
数据结构第2章花了2个礼拜才搞定,工作忙,业余时间少了。总结2个算法:随机漫步和骑士旅行(题目参见p62)随机漫步:一只大蟑螂在m*n的格子上随机行走,经过多少次可以走遍整个格子 // algorithm random walk.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include using原创 2013-05-16 22:12:32 · 783 阅读 · 0 评论 -
快速计算log2()
lua源码里看到的,这个应该优化的很好了吧 int luaO_log2 (unsigned int x) { static const lu_byte log_2[256] = { 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 6,6,6,6,6,6,6,6,6,6,6,6,转载 2013-11-24 19:05:35 · 3525 阅读 · 4 评论