码迷,mamicode.com
首页 >  
搜索关键字:algorithm trading    ( 11829个结果
c++ stl algorithm: std::fill, std::fill_n
std::fill 在[first, last)范围内填充值#include #include #include int main(){ std::vector v; v.resize(10); std::fill(v.begin(), v.end(), 100); retu...
分类:编程语言   时间:2014-05-24 05:15:36    阅读次数:320
Algorithm for Maximum Subsequence Sum z
MSS(Array[],N)//Where N is the number of elements in array{sum=0; //current summax-sum=0;//Maximum Sumseq-start=0;//start of the subsequenceseq-end=0;...
分类:其他好文   时间:2014-05-23 11:03:58    阅读次数:221
【剑指offer】旋转数组中的最小值
题目总结: 1.若没有进行旋转,或者说旋转后的效果跟没有旋转是一样的,那么index1指示的值小于index2指示的值,返回index1的值。 2.若是一般性的旋转,那么最小的值旋转后肯定在中间,那么我们就可以从两边向中间夹逼。 3.夹逼的过程中,若 [ index1, middle ] 是有序的,说明这部分子区间没被破坏,旋转所移动的元素都在middle 的后面,那么最小值可定也在后面的部...
分类:其他好文   时间:2014-05-22 13:42:45    阅读次数:236
CareerCup之2.2 寻找单链表倒数第n个元素
【题目】 原文: 2.2 Implement an algorithm to find the nth to last element of a singly linked list. 译文: 实现一个算法从一个单链表中返回倒数第n个元素。 【分析】 【思路一】 (1)创建两个指针p1和p2,指向单链表的开始节点。 (2)使p2移动n-1个位置,使之指向从头...
分类:其他好文   时间:2014-05-22 09:03:53    阅读次数:315
LeetCode: Search for a Range [033]
【题目】 Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target is not found in the array, return [-1, -1]. For example, Given [5...
分类:其他好文   时间:2014-05-22 06:44:39    阅读次数:265
Best Time to Buy and Sell Stock III
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:其他好文   时间:2014-05-21 17:27:55    阅读次数:252
LeetCode: First Missing Positive [040]
【题目】 Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] return 3, and [3,4,-1,1] return 2. Your algorithm should run in O(n) time and uses constant space. 【题意】 给定一个数组,找出第一个缺失的正数。时间复杂度O(n) ...
分类:其他好文   时间:2014-05-21 17:13:07    阅读次数:219
【leetcode】Divide Two Integers
题目:不用乘、除、取模运算来实现除法。 减法可以实现除法在是我们早就知道的,但是可能会出现问题,比如极端情况,a = 0x7FFFFFFF,b = 1,求a/b,这要减法运算多少次? 回想下我们开始学习计算机的时候,涉及到的进制之间的转换,就是给定你一个十进制数,写出他的二进制,刚开始的时候很傻,就按着书上的方法去不停的除以2,除以2,除以2,。。。可笑的是居然天真的算过1024的二进制,更可...
分类:其他好文   时间:2014-05-21 08:32:30    阅读次数:191
POJ 2677(双调旅行商问题<bictonicTSP>
Tour Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3470 Accepted: 1545 Description John Doe, a skilled pilot, enjoys traveling. While on vacation, he rents a...
分类:其他好文   时间:2014-05-21 08:24:18    阅读次数:354
LeetCode:Single Number II
题目:     Given an array of integers, every element appears three times except for one. Find that single one.     Note:     Your algorithm should have a linear runtime complexity. Could you implem...
分类:其他好文   时间:2014-05-20 16:22:52    阅读次数:241
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!