摘要: #include <iostream> using namespace std; int father[100]; //初始化 void init() { for(int i = 0; i < 100; ++ i) { father[i] = i; } } //查找根节点,按路径优化 int fin 阅读全文
posted @ 2016-09-30 21:42 zq216991 阅读(111) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;class Stack{public: Stack();//初始化 Stack(int _size); ~Stack(); bool empty(); //栈是否为空 int top(); ... 阅读全文
posted @ 2016-09-30 21:34 zq216991 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 对于最长公共字符串问题: 我的方法是采用动态规划求解,所有格子默认为0,当字符相同时就在对应的格子填入其左上角数字加1的结果。然后格子中的最大值即最大公共字符串的长度。 #include#include#includeusing namespace std;//str1为横向,st... 阅读全文
posted @ 2016-09-30 20:47 zq216991 阅读(422) 评论(0) 推荐(1) 编辑