一、使用临时变量C版本:void swap(int* a, int* b){int temp = 0;temp = *a;*a = *b;void swap(int& a, int& b){int temp = 0;temp = a;a = b;b = temp;}*b = temp;}C++版本:...
分类:
其他好文 时间:
2015-03-16 22:31:49
阅读次数:
106
问题描述:
随机生成k个不重复的随机数(或生成0至k-1以随机顺序构成的数列)
算法:
rand不直接产生值,而是产生下标,下标可以重复,但要保证数组中都是不重复且没有输出过的数字
①一个大小为k的数组temp,temp[i]=i;一个随机下标的范围range,range初始为k;一个随机数组result
②随机生成0至range-1的一个下标index,将temp[index]...
分类:
其他好文 时间:
2015-03-15 09:37:43
阅读次数:
125
第一步:创建临时表空间CREATE TEMPORARY TABLESPACE DB_TEMP TEMPFILE 'D:\oracle\product\10.2.0\oradata1\orcl\DB_TEMP.DBF' SIZE 32M AUTOEXTEND ON NEXT 32M MAxSIZE U...
分类:
数据库 时间:
2015-03-14 13:48:23
阅读次数:
155
表值函数返回的是一张表。情况:把传入的字符串按指定分隔符转换成数组理解:把字符串打散,逐个插入表,这个表就是需要的数据Create Function [dbo].[Split]( @Sql varchar(8000), @Splits varchar(10))returns @temp ...
分类:
数据库 时间:
2015-03-14 12:14:01
阅读次数:
132
C/C++中参数传递有两种方式,传值或传地址(传引用),通常我们要在被调用函数中改变一个变量的值就需要传地址调用方式,例如:void swap_by_value(int a, int b){ int temp; temp = a; a = b; b = temp;}voi...
分类:
编程语言 时间:
2015-03-14 10:55:53
阅读次数:
163
/*
题目描述:
输入一个字符串,长度小于等于200,然后将输出按字符顺序升序排序后的字符串。
输入:
测试数据有多组,输入字符串。
输出:
对于每组输入,输出处理后的结果。
样例输入:
bacd
样例输出:
abcd
*/
# include
# include
int main(void)
{
int len,i,j;
char s[210],temp;
while(scanf("...
分类:
编程语言 时间:
2015-03-13 23:49:17
阅读次数:
321
//方法一 var arr1 = [1,2,3,4,5,6,7,8]; //数组A var arr2 = [1,2,3,11,12,13,14];//数组B var temp = []; //临时数组1 var temparra...
分类:
编程语言 时间:
2015-03-13 10:33:32
阅读次数:
157
/// /// 交换两个整数的值 /// /// 数1 /// 数2private static void Swap(ref int aa,ref int bb) { int temp; temp = bb; bb = aa; aa = temp; }// 冒泡排序 class Program...
分类:
编程语言 时间:
2015-03-12 14:33:31
阅读次数:
149
求数组中的逆序对
#include
using namespace std;
int MergeArray(int r[],int s,int m,int e,int temp[]){
int i=m,j=e,count=0,k=0;
while(i>=s&&j>=m+1){
if (r[i]>r[j]){
temp[k]=r[i];
k++;
count=count+...
分类:
编程语言 时间:
2015-03-12 11:32:13
阅读次数:
172
1 void BubbleSort(int unsort[],const int count) 2 { 3 for (int i = 0; i unsort[j+1]) 9 {10 temp = unsort[j];11 ...
分类:
编程语言 时间:
2015-03-11 22:56:40
阅读次数:
189