码迷,mamicode.com
首页 >  
搜索关键字:algorithm trading    ( 11829个结果
C++ Primer笔记6_STL之泛型算法
1.泛型算法: 大多数算法定义在头文件algorithm中,标准库还在头文件numeric中定义了一组数值泛型算法 举例: find函数用于找出容器中一个特定的值,有三个参数 int val = 10;//val为我们需要查找的值 auto result = find(vec.begin(), vec.end(), val): cout find将前两个表示范围的迭代器内的元素与va...
分类:编程语言   时间:2014-06-09 23:35:41    阅读次数:279
[LeetCode] Palindrome Partition [11]
题目:Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. 解题思路: 回文划分,题目意思是给一个字符串,找出将字符串划分为一系列回文子串的各种可能组合。例如,一个子串“aab“,你需要返回["aa","b"],["a","a","b"]。这个题目的解法也是非常的典型---循环加递归,...
分类:其他好文   时间:2014-06-09 23:24:11    阅读次数:256
[LeetCode] Valid Palindrome [10]
题目:For example,"A man, a plan, a canal: Panama" is a palindrome. "race a car" is not a palindrome. 解题思路:验证一个字符串是否是回文字符串。首先看看wiki上对于回文的解释:回文,亦称回环,是正读反读都能读通的句子,亦有将文字排列成圆圈者,Famous examples include "Amore, Roma", "A man, a plan, a canal: Panama" and "No 'x' in...
分类:其他好文   时间:2014-06-08 16:30:29    阅读次数:235
[LeetCode] Palindrome Number [13]
题目: Determine whether an integer is a palindrome. Do this without extra space. 解题思路: 判断一个int型整数是不是回文数字,这个题也不难,依次取得数字最高位和最低位进行比较,就可以判断是不是回文数字。需要注意的是负数不是回文数字。 代码实现:...
分类:其他好文   时间:2014-06-08 15:35:48    阅读次数:375
【leetcode】Construct Binary Tree from Preorder and Inorder Traversal
问题: 给定二叉树的前序和中序遍历,重构这课二叉树. 分析: 前序、中序、后序都是针对于根结点而言,所以又叫作先根、中根、后根(当然不是高跟)。 前序:根  左 右 中序:左  根 右 对二叉树,我们将其进行投影,就会发现个有趣的事: 发现投影后的顺序,恰好是中序遍历的顺序,这也就是为什么在构造二叉树的时候,一定需要知道中序遍历,因为中序遍历决定了结点间的相对左右位置关系。所...
分类:其他好文   时间:2014-06-08 15:20:12    阅读次数:214
[LeetCode] Palindrome Partitioning II [12]
题目:For example, given s = "aab", Return 1 since the palindrome partitioning ["aa","b"] could be produced using 1 cut 解题思路:给一个字符串,如果字符串可以划分成若干子回文字符串,返回最小的划分数量。 这个题如果还用之前求所有划分组合的循环加递归方法的话,就会得到超时的错误。这是就要考虑别的方法,动态规划倒是一个不错的方法,但是动态规划最重要的是要找到动态方程。本题的动态方程: dp[i] =...
分类:其他好文   时间:2014-06-08 14:56:58    阅读次数:257
【leetcode】Construct Binary Tree from Inorder and Postorder Traversal
问题: 由中序和后序遍历构造二叉树。 分析: Construct Binary Tree from Preorder and Inorder Traversal //实现 TreeNode *addNode(vector &inorder, int s1, int end1, vector &postorder, int s2, int end2) { ...
分类:其他好文   时间:2014-06-08 09:56:52    阅读次数:206
【LeetCode】Single Number (2 solutions)
Single NumberGiven an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runti...
分类:其他好文   时间:2014-06-07 23:44:39    阅读次数:302
Algorithm | Vector
因为平常用的话只是vector的一些非常简单的功能,基本上把它当数组来用,现在也只是把这一部分写了一些。 1 template 2 class XVector { 3 public: 4 XVector(int cacheSize):cacheSize(cacheSize), count(0...
分类:其他好文   时间:2014-06-07 23:28:39    阅读次数:287
Algorithm | hash
A basic requirement is that the function should provide a uniform distribution of hash values. A non-uniform distribution increases the number of coll...
分类:其他好文   时间:2014-06-07 16:58:29    阅读次数:240
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!