随笔分类 - adb
摘要:这篇将是最有难度和挑战性的一篇,做好心理准备!十、二叉查找树(BST)前一篇介绍了树,却未介绍树有什么用。但就算我不说,你也能想得到,看我们Windows的目录结构,其实就是树形的,一个典型的分类应用。当然除了分类,树还有别的作用,我们可以利用树建立一个非常便于查找取值又非常便于插入删除的数据结构,
阅读全文
摘要:搜狐科技 文/毛启盈 1月25日,华为消费者业务发布“2015年度?华为消费者云服务白皮书”(以下简称“白皮书”)显示,截止2015年年底,华为消费者云服务移动用户突破1.3亿。华为应用市场2015年全年应用下载量175亿,单日下载峰值高达1.4亿。 白皮书干货分享: 1、数据显示,华为云服务用户,
阅读全文
摘要:http://web.airdroid.com/ 好多功能呀,有空研究研究 http://jingyan.baidu.com/article/b24f6c82cd4ade86bfe5daf3.htmlhttp://pcedu.pconline.com.cn/316/3169567_all.htmlh
阅读全文
摘要:字符串模式匹配算法——BM、Horspool、Sunday、KMP、KR、AC算法一网打尽本文内容框架:§1 Boyer-Moore算法§2 Horspool算法§3 Sunday算法§4 KMP算算法§5 KR算法§6 AC自动机§7 小结§1 Boyer-Moore(BM)算法Boyer-Moo...
阅读全文
摘要:解题心的: 就是基本的一对一模拟手算。。借助c++的string 不用逆序运算了。很方便的补0. 最后处理下前导0的问题。#include #include using namespace std;// 实现大数相加 结果存放在num中 void bigIntergerAdd(string &nu...
阅读全文
摘要:// 17x4.cpp : Defines the entry point for the console application.//#include "stdafx.h"// 分支界定法:最大装载问题,获得最优路径(使用FIFO),深刻学习指针的引用的本质#include <iostream.h>#include "lqueue.h"#include "qnode.h" // QNode具有一个QNode *parent, bool LChild, T weight三个属性// 如果不是叶节点,就加入到Q队列里。新节点
阅读全文
摘要:// 17x2.cpp : Defines the entry point for the console application.//#include "stdafx.h"// 分支界定法:最大装载问题,改进版(使用FIFO)#include<iostream.h>#include "lqueue.h"template<class T>T GetMaxLoading(T w[], T c, int n){ LinkedQueue<T> Q; // 为第一层初始化 Q.Add(-1); int i = 1; T Ew
阅读全文
摘要:// 17x1.cpp : Defines the entry point for the console application.//#include "stdafx.h"// 分支界定法:最大装载问题(使用FIFO)#include <iostream.h>#include "lqueue.h"// 所有参数里,最重要的是当前路径的累计权重wt,其余都是辅助参数template<class T>void AddLiveNode(LinkedQueue<T> &Q, T wt, T& bestw, i
阅读全文
摘要:// 16x5.cpp : Defines the entry point for the console application.//#include "stdafx.h"// 回溯法:0/1背包问题(利用价值密度进行优化)// 左孩子的界限函数的价值与父节点相同,因为总价值=cp+子树价值。当向左孩子移的时候,那部分价值已经计入了新的cp了。#include <iostream.h>#include "msort.h"#include "object.h" // 内含两部分数据:物品标识,物品价值密度template&
阅读全文
摘要:// 16x3.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include<iostream.h>template<class T>class Loading { friend GetMaxLoading(T [], T, int, int []); private: void Compute(int i); int n, *x, // 当前取值 *bestx; // 目前的最佳方案 ...
阅读全文
摘要:// 16x2.cpp : Defines the entry point for the console application.//#include "stdafx.h"// 优化了回溯代码// 即不移动到不可能包含比当前最优解还要好的解的右子树#include<iostream.h>template<class T>class Loading { friend GetMaxLoading(T [], T, int); private: void Compute(int i); int n; // 货箱数量 T *w, // 货箱重量数组...
阅读全文
摘要:// 16x1.cpp : Defines the entry point for the console application.//#include "stdafx.h"// 回溯法,解空间分为排列数和子集树,前者是不同节点顺序的排列,后者是一个(0,1,...)的向量子集// 最大装载问题,是一个NP问题,目前只计算第一艘船,属于子集树// 有几个货物,子集树就有几层,当前题目为5层// 我感觉递归还是太过于精巧和经凑,很难挖空心思自己写出来,多熟悉别人现有的程序是一个好办法。#include<iostream.h>template<class T&
阅读全文
摘要:// 15x2.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream.h>#include <stdlib.h>#include "dosmax.h" // has max() and min()#include "make2db.h" // void Make2DArray(T ** &x, int rows, int cols)// 动态规划:0-1背包问题(
阅读全文
摘要:// 最优原则:不管前面的策略如何,此后的决策是是基于当前状态(由上一次决策产生)的最优决策。// 当最优决策序列中包含最优决策子序列时,可建立动态规划递归方法。// (有些问题的递归式不一定能保证最优原则,因此在求解时有必要对它进行验证。若不能保持最优原则,则不可应用动态规划方法。)// 在得到最
阅读全文