红桃J

用心写好每行完美的代码,远比写一堆更有价值

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
上一页 1 2 3 4 5 6 7 8 ··· 15 下一页

2015年5月13日

摘要: 代码:个人浅薄的认为DFS就是回溯法中的一种,一般想到用DFS我们脑中一般都有一颗解法树,然后去按照深度优先搜索去寻找解。而分支界限法则不算是回溯,无论其是采用队列形式的还是优先队列形式的分支界限法。下面这个函数就是我的DFS的函数,先介绍一下参数的含义,index表示当前要判断是否合适的candi... 阅读全文
posted @ 2015-05-13 15:42 红桃J 阅读(495) 评论(0) 推荐(0) 编辑

摘要: 代码: 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 8 string countAndSay(int n) 9 {10 string s = "1";11 int i = 0; 12 wh... 阅读全文
posted @ 2015-05-13 15:30 红桃J 阅读(124) 评论(0) 推荐(0) 编辑

2015年5月12日

摘要: 下面是这两个题的解法:参考博客:http://blog.csdn.net/loverooney/article/details/38455475自己写的第一题(TLE): 1 #include 2 #include 3 4 using namespace std; 5 6 bool canJum... 阅读全文
posted @ 2015-05-12 19:53 红桃J 阅读(217) 评论(0) 推荐(0) 编辑

2015年5月11日

摘要: 代码:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : va... 阅读全文
posted @ 2015-05-11 22:36 红桃J 阅读(89) 评论(0) 推荐(0) 编辑

摘要: 异或运算的使用代码: 1 int singleNumber(int* nums, int numsSize) { 2 int i, result = nums[0]; 3 if(numsSize<=0) 4 return 0; 5 f... 阅读全文
posted @ 2015-05-11 22:24 红桃J 阅读(134) 评论(0) 推荐(0) 编辑

摘要: 代码: 1 #include 2 #include 3 4 using namespace std; 5 6 int search(vector& nums, int target) 7 { 8 int L = nums.size(); 9 int k = 0;10 i... 阅读全文
posted @ 2015-05-11 19:07 红桃J 阅读(130) 评论(0) 推荐(0) 编辑

摘要: 错误代码: 1 #include 2 3 using namespace std; 4 5 int longestValidParentheses(string s) 6 { 7 int i = 0; 8 int L = s.length(); 9 int j;10 ... 阅读全文
posted @ 2015-05-11 11:32 红桃J 阅读(128) 评论(0) 推荐(0) 编辑

摘要: 代码: 1 #include 2 #include 3 4 using namespace std; 5 6 int length = 9; 7 8 bool isValidSudoku(vector>& board) 9 {10 int flag[9];11 memset(... 阅读全文
posted @ 2015-05-11 09:34 红桃J 阅读(156) 评论(0) 推荐(0) 编辑

2015年5月6日

摘要: 问题描述:把一个包含n个正整数的序列划分成m个连续的子序列。设第i个序列的各数之和为S(i),求所有S(i)的最大值最小是多少?例如序列1 2 3 2 5 4划分为3个子序列的最优方案为 1 2 3 | 2 5 | 4,其中S(1),S(2),S(3)分别为6,7,4,那么最大值为7;如果划分为 1... 阅读全文
posted @ 2015-05-06 23:23 红桃J 阅读(1564) 评论(0) 推荐(0) 编辑

摘要: http://blog.csdn.net/sealyao/article/category/592336博客中介绍了一些算法:BP神经网络算法朴素贝叶斯与贝叶斯信念网络决策树算法…… 阅读全文
posted @ 2015-05-06 16:23 红桃J 阅读(148) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 ··· 15 下一页