
acm算法学习
文章平均质量分 80
c_spark
热爱计算机编程,有着积极的学习心态,不断提升个人能力,路漫漫其修远兮,吾将上下而求索...
展开
-
QuickSort分析,这是回复提问时碰到的,顺便对学过的算法进行复习,总结...
这个算法与C语言数据结构是的有所不同,不过性质一样都是采用分治法来实现的平均时间复杂度为O(nlgn) ,最坏为O(n^2)主要思想就是维持两个区间,左区间的元素小于mid,右区间则反之,对区间元素进行处理 void QuickSort(vector & v, int low, int high) { int temp; if(low原创 2008-04-07 12:17:00 · 554 阅读 · 0 评论 -
acm pku 1007 DNA Sorting
DNA SortingDescriptionOne measure of ``unsortedness in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the letter sequence ``DAA原创 2008-04-03 12:55:00 · 1077 阅读 · 0 评论 -
最大子矩阵和(To The Max)
Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1 x 1 or greater located within the whole array. The sum of a rectangle is the原创 2008-04-26 08:52:00 · 3817 阅读 · 1 评论 -
二叉树三种非递归的遍历方式
二叉树遍历 Problem description 遍历一棵二叉树就是按某种次序系统地“访问”二叉树上的所有结点,并使每一个结点恰好被访问一次。所谓“访问”一个结点,是指对该结点的数据域进行某种处理,处理的原创 2008-05-15 12:36:00 · 1674 阅读 · 0 评论 -
Scramble Sort
Scramble Sort Problem description In this problem you will be given a series of lists containing both w原创 2008-05-15 12:52:00 · 869 阅读 · 0 评论 -
数值计算A Star not a Tree? (八个方向搜索中心坐标点)
A Star not a Tree? Problem description Luke wants to upgrade his home computer network from 10mbs to 10原创 2008-05-15 13:12:00 · 1608 阅读 · 0 评论 -
使用动态规划算法解决Broken Necklace
Broken Necklace你有一条由N个红色的,白色的,或蓝色的珠子组成的项链(3,珠子是随意安排的。 这里是 n=29 的二个例子:第一和第二个珠子在图片中已经被作记号。 图片 A 中的项链可以用下面的字符串表示: brbrrrbbbrrrrrbrrbbrbbbbrrrrb . 假如你要在一些点打破项链,展开成一条直线,然后从一端开始收集同颜色的珠子直到你遇到一个不同原创 2008-05-17 15:47:00 · 3838 阅读 · 1 评论