码迷,mamicode.com
首页 >  
搜索关键字:algorithm    ( 11758个结果)
Word Search
[leetcode]Word Search...
分类:其他好文   时间:2014-09-17 23:26:03    阅读次数:388
统计电影票房排名前10的电影并存入另一个文件
今天看到一个笔试题,是这样的:给定一个文件(m.dat),里面保存了各个电影票房统计,要求写程序统计票房排名前10的电影,并把统计结果存入另一个文件。自己试着用C++实现一下,代码分享如下:(linux下gcc 编译) gcc编译,执行时要传入两个命令行参数,比如:./a.out m.dat li.dat (m.dat为源票房文件,li.dat 为存放前10的文件)...
分类:其他好文   时间:2014-09-17 23:25:32    阅读次数:404
Valid Palindrome
[leetcode]Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases....
分类:其他好文   时间:2014-09-17 23:24:22    阅读次数:198
Reverse Integer
[leetcode]Reverse Integer...
分类:其他好文   时间:2014-09-17 21:55:22    阅读次数:209
Remove Duplicates from Sorted Array
[leetcode]Remove Duplicates from Sorted Array...
分类:其他好文   时间:2014-09-17 21:54:52    阅读次数:199
Remove Element
[leetcode]Remove Element...
分类:其他好文   时间:2014-09-17 21:54:42    阅读次数:196
uva 10154 - Weights and Measures【dp】qi
题意:uva 10154 - Weights and Measures 题意:有一些乌龟有一定的体重和力量,求摞起来的最大高度、力量必须承受其上面包括自己的全部的重量。 分析:先按力量从小到大排序 然后定义dp【i】 表示摞起来 i 只乌龟的最小质量。 然后转移就是每次用遍历O(n)的负责度找最小的,然后记录,保存最大值即可。 AC代码: #include #i...
分类:其他好文   时间:2014-09-17 20:31:02    阅读次数:224
Leetcode_num1_Single Number
好久没有做题啦,从今天开始刷Leetcode的题,希望坚持的时间能长一点。先从ac率最高的Single Number开始吧。 题目: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should hav...
分类:其他好文   时间:2014-09-17 20:30:53    阅读次数:254
uva 10069 Distinct Subsequences 【dp+大数】
题目:uva 10069 Distinct Subsequences 题意:给出一个子串 x 和母串 s ,求子串在母串中的不同序列的个数? 分析:定义dp【i】【j】:x 的前 i 个字母在 s 的前 j 个字母中的出现次数; dp [ i ] [ j ] = dp [ i ] [ j - 1 ] ;          if ( x[ i ] == s [ j ] ) ...
分类:其他好文   时间:2014-09-17 18:45:42    阅读次数:327
STL algorithm算法make_heap和sort_heap(32)
make_heap原型: std::make_heap default (1) template void make_heap (RandomAccessIterator first, RandomAccessIterator last); custom (2) template void make_heap (Rando...
分类:其他好文   时间:2014-09-17 18:43:42    阅读次数:241
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!