//字符串全排列package com.demo.acm;public class
AllSortChar { public static void allSort(char[] buf,int start,int end){
if(start==end){ ...
分类:
其他好文 时间:
2014-05-02 19:43:21
阅读次数:
256
sortTime Limit: 6000/1000 MS (Java/Others)Memory
Limit: 65536/32768 K (Java/Others)Total Submission(s): 25803Accepted
Submission(s): 7764Problem Descr...
分类:
其他好文 时间:
2014-05-01 20:50:16
阅读次数:
583
首先,permutation指的是对元素的重排,比如a , b , c 三个元素的所有的重排为 abc, acb, bac,bca,cab,cba 总共 3! = 6 中情况,但是如何声称这六种情况呢,C++标准库定义了函数 next_permutation,来生成一组元素的所有的全排列。
首先,了解该函数的声明以及实现:
函数声明为: [摘自 www.cplusplus.com]...
分类:
编程语言 时间:
2014-05-01 18:31:34
阅读次数:
268
1 保留小数点后两位#include cout const char * spilt="/";char
*p;p=strtok(str,spilt);while(p!=NULL){ //cout
#includesort(Rs.begin(),Rs.end());sort(Rs.begin(),Rs...
分类:
编程语言 时间:
2014-05-01 05:05:45
阅读次数:
409
package algorithm.sort;public class QuickSort {
public static void main(String[] args) { int[] a = new int[] {5, 3, 7, 2, 1, 4,
9, 8, 6, 1}; sort(a); ...
分类:
其他好文 时间:
2014-05-01 03:33:20
阅读次数:
330
package algorithm.sort;public class CountingSort {
public static void main(String[] args) { int[] a = new int[] {5, 3, 7, 2, 1, 4,
9, 8, 6, 1}; int[] ...
分类:
其他好文 时间:
2014-05-01 03:25:05
阅读次数:
252
package algorithm.sort;public class HeapSort {
public static void main(String[] args) { int[] a = new int[] {5, 3, 7, 2, 1, 4,
9, 8, 6, 1}; sort(a); p...
分类:
其他好文 时间:
2014-05-01 03:24:04
阅读次数:
332
1.stable_sort 和 sort的区别在于 前者作排序可以使原来的"相同"的值在序列中的相对位置不变
如 1 4 6 7 4' (4 和 4'值相等,加上' 表示是2个元素)
那么stable_sort能保证排序完 4 仍然在4' 前 也就是输出1 4 4' 6 7;但是sort 没有这个功能,算法不能保证这一点
2.在标准算法中的一部分算法 如果这个算法默认使用的是
...
分类:
其他好文 时间:
2014-04-29 13:45:20
阅读次数:
273
在sort中因为默认是升序的,所以一般我们需要降序的时候就……了。
以前我在CF上看到有人用sort的数组降序方法,快速简单,然后刚才写425A - Sereja and Swaps题的时候又看到别人vector的降序方法,以前学习的时候怎么不知道呢,哈哈……虽然CF没多大建树,不过确实看到好多大神的编程方法以及优化方法,实在是很有用啊!
很多时候不是我们不懂,而是我们不会优化,对系统的函数用...
分类:
其他好文 时间:
2014-04-29 13:16:21
阅读次数:
322