![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
文章平均质量分 55
oceanwavewyt
这个作者很懒,什么都没留下…
展开
-
背包问题--动态规划 -- 写一个简短的程序(php)
<? /***背包问题描述:一个承受最大重量为W的背包,现在有n个物品,每个物品重量为t, 每个物品的价值为v。* 要使得这个背包重量最大(但不能超过W),同时又需要背包的价值最大。*思路:定义一个二维数组,一维为物品数量(表示每个物品),二维是重量(不超过最大,这里是15),下面数组a,* 动态规划原理思想,max(opt(i-1,w),wi+opt(i-1,w-w原创 2009-08-24 17:50:00 · 2127 阅读 · 1 评论 -
相对路径和绝对路径的相互转换 (转化)
<?/** * @author wyt * 个人分析字符串的方法来得到。不知道有没有更好的方法 * 希望大家有好的建议能提出来 */$a=/a/b/c/d/w.php;$b=/a/b/24/23/ws.php;//$b=/a/b/23/ws.php;echo rep($a,$b);/** * 计算相对路径 * * @param 当前路原创 2009-12-08 13:34:00 · 9729 阅读 · 1 评论 -
innodb内部结构分析
<br />Because InnoDB is a multi-versioned storage engine, it must keep information about old versions of rows in the tablespace. This information is stored in a data structure called a rollback segment (after an analogous data structure in Oracle).<br />翻译 2010-11-18 11:43:00 · 593 阅读 · 0 评论 -
活跃度队列
pre (..(next=>c),c=>array(null)) ne (head=>d,d=>array('next'=>c,'previous'=>'head'),c=>array(),e=>array()....) (.....)ne => preif(len>100){pre[lastid2]['next']=uid;pre[uid] = array('time'=>time(),'next'=>null);ne[lastid] = pre[lastid];ne[lastid]['next']=原创 2010-11-18 19:01:00 · 807 阅读 · 0 评论 -
c++当中strtotime函数
把字符串转换为时间戳unsigned long strtotime(char *date){ struct tm t; unsigned long time; sscanf(date,"%d-%d-%d",&t.tm_year,&t.tm_mon,&t.tm_mday); t.tm_year-=1900;原创 2012-04-27 11:11:07 · 3030 阅读 · 0 评论 -
计算程序运行时间
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;int main(int argc, char** arg原创 2012-07-16 17:25:22 · 598 阅读 · 0 评论 -
leveldb的compact条件
先看一段代码:Compaction* VersionSet::PickCompaction() { Compaction* c; int level; // We prefer compactions triggered by too much data in a level over // the compactions triggered by seeks. co原创 2012-11-07 17:52:05 · 2686 阅读 · 0 评论 -
快速排序算法实现
$data = array(39,42,20,38,50,35,69,78,164,85,79);function pt($low,$high){ global $data; $tmp = $data[$high]; if($high<=$low) return; while($low<$high) { while($low=$data[$low]){ $low++; }原创 2009-09-20 10:19:00 · 361 阅读 · 0 评论 -
riser服务key/value服务介绍-基于leveldb
一直太懒,没有把riser介绍给大家。这次终于下了决心和大家分享一下我的riser。写得有问题的地方,大家可以提出来,互相探讨一下。概述riser 是一个基于leveldb存储引擎的key/value服务,以及可以提供队列服务。性能测试: 在 Intel(R) Pentium(R) CPU G620 @ 2.60GHz memory: 1GHz原创 2013-07-01 18:03:29 · 1237 阅读 · 0 评论