快速排序算法是冒泡排序的一种改进,先找到一个元素,设置2各游标,i从前到后遍历,j从后向前遍历,如果第j个小于此元素,则调换,然后i++,如果遇到第i个大于此元素,则调换。其实这就是一个挖坑-填坑的过程。具体的代码如下:int base_quicksort(int A[], int first, i...
分类:
其他好文 时间:
2014-09-28 19:44:45
阅读次数:
211
A number of K balls are dropped one by one from the root of a fully binary tree structure FBT. Each time the ball being dropped first visits a non-terminal node. It then keeps moving down, either foll...
分类:
其他好文 时间:
2014-09-28 14:31:12
阅读次数:
288
typedef std::basic_string tstring;inline static void trim(tstring& s){ s.erase(0, s.find_first_not_of(_T("\r\t\n "))); s.erase(s.find_last_not_of(_T("...
分类:
编程语言 时间:
2014-09-28 14:27:52
阅读次数:
222
要让一个TextBox显示多行文本就得把它的Multiline属性设置为true,可是如果你是要把TextBox的Text属性设置多行文本时,换行符由两个字符组成:"\r\n"。TextBox1.Text = "First \nSecond \nThird ";运行的时候不会换行。其实主要是因为Te...
分类:
其他好文 时间:
2014-09-28 12:22:51
阅读次数:
190
Problem Description
A range is given, the begin and the end are both integers. You should sum the cube of all the integers in the range.
Input
The first line of the input is T(1
Each...
分类:
其他好文 时间:
2014-09-28 01:35:40
阅读次数:
151
1. Basic Regular Expression a. "^" matching the head of a line. "^" must be the first character in a regular expression ,else it only a common ch...
分类:
其他好文 时间:
2014-09-27 19:08:30
阅读次数:
160
将img放置在div中,通过移动div达到移动img的效果,下面是水平移动。 html文件: js文件:var i=10;function transferImages(){ var first = document.ge...
分类:
移动开发 时间:
2014-09-27 18:10:30
阅读次数:
166
Gold Coins
Time Limit: 1000MS Memory Limit: 30000K
Total Submissions: 21155 Accepted: 13265
Description
The king pays his loyal knight in gold coins. On the first day of his service, the...
分类:
其他好文 时间:
2014-09-27 14:29:09
阅读次数:
200
要使列表逆序的话,大多数人包括我一半都会选择在ol标签里使用reversed属性 first second third fourth fifth sixth 效果展示: 未使用reversed:使用reversed后: 但是,reversed有很多的限制...
分类:
Web程序 时间:
2014-09-27 04:32:19
阅读次数:
221
深度优先搜索(DFS, Depth-First Search)是搜索的手段之一。它从某个状态开始,不断地转移状态直到无法转移,然后退到前一步的状态,如此不断重复,直至找到最终的解。部分和问题给定整数a1、a2、……、an,判断是否可以从中选出若干个数,使它们的和恰好为k。限制条件1 ≤ n ≤ 20...
分类:
其他好文 时间:
2014-09-27 00:38:38
阅读次数:
245