Algorithm
文章平均质量分 73
bigbear802
这个作者很懒,什么都没留下…
展开
-
储油点问题的解答
储油点问题是一个经典的递推问题,是关于倒推算法的一个非常典型的应用。下面给出其算法(C++描述): /**//* Name: sation of oil Copyright: all right reserved @ [email protected] Author: [email protected] Date: 23-01-08 16:57 Description:原创 2008-01-24 09:34:00 · 1429 阅读 · 0 评论 -
删数问题
刚才看成文虎先生的“实用算法的分析与应用”一书中的“删数问题”,感觉先生给出的算法有错误。与大家讨论之。 先叙述一下问题: 键盘输入一个高精度的正整数N,去掉其中任意S个数字后剩下的数字按原来左右次序组成一个新的正整数。编程对给定的N和S,寻找一种方案使得剩下的数字组成的新数最小。 输出英包含所去掉的数字的位置和组成的新的正整数(N原创 2008-01-24 20:27:00 · 1433 阅读 · 0 评论 -
Implemention of Partition Function
partition是一个非常有用,且常见的操作,因此,探讨他的高效实现是非常有意义的一件事情,在上一篇文章里,已经给出了两种实现方式,本文在给出两种实现方式.实现方式的巧妙我无法用语言告诉你,只用你自己去体会了.version Iint partition(int *array, int low, int high) ...{ int pivotpos = low; in原创 2008-01-28 09:49:00 · 402 阅读 · 0 评论 -
背包问题的贪心算法
背包问题是一个经典的问题,到现在还没有多项式时间的算法去解决它.本文是背包问题的贪心算法,当然是一个非多项式算法. #include iostream>#include vector>#include algorithm>using namespace std;struct Treasure...{ int no; int quantity; int price;原创 2008-01-25 09:29:00 · 2214 阅读 · 0 评论 -
Maximin of substring
本文该处了最大字段和问题的朴素算法,分治法,动态规划法的实现. /**//* * Description: a directing approach * name: sum_of_substring * parameters: string: string to calculate the maximun sum. * len : the le原创 2008-01-29 17:11:00 · 368 阅读 · 0 评论 -
longest common subsequence
Following is a DP solution of this problem. /**//* Name: LCS.H Copyright: All Right Reserved 2008 Li Zu-ding Author: li zu-ding Date: 29-02-08 08:47 Description: this code is the answer of原创 2008-02-29 19:47:00 · 508 阅读 · 0 评论 -
Implementation of Heap Sort
Follow is the C++ code of heap sort:templatevoid _heap_sort(T * pUnsort, size_t len) { for (int i = len; i >0; --i) { _make_heap(pUnsort, i); std::swap(pUnsort[0], pUnsort[原创 2008-07-10 09:14:00 · 470 阅读 · 0 评论 -
Recommended Informatics (CS) Literature
Of course, it is also recommended that you read books onother disciplines.A nice and gentle introduction into the world of computers is(also see book review by Peter G. Neumann inACM SIG转载 2009-02-20 17:56:00 · 605 阅读 · 0 评论