51CTO博客开发
//基数排序,对每一位的排序采用的插入排序(可改为快速排序或计数排序效果更好) #include<iostream> #include<math.h> using namespace std; void InsertSort( int* array_A, int* array_B, int&n
#include<iostream> using namespace std; void InsertSort( int* array, int n ) { int j, temp; for
#include<iostream> using namespace std; void exch( int* x, int* y ) { int temp = *x; *x&nbs
#include<iostream> using namespace std; void SetArray_C( int* a, int* c, int n, int k) { for( int i 
#include<iostream> using namespace std; void MergeArray( int* a, int lhs, int mid, int rhs , int* temp) {  
#include<iostream> using namespace std; void swap( int* x, int* y) { int temp = *x; *x =&n
//回溯法解决数字拆解的问题 #include<iostream> using namespace std; const int N = 6; void OutPut( int* a, int N ) { for(&n
//简单选择排序源码 void SelectSort( int a[], int n ) { int i, j; for( i = 0; i < n - 1; i++ ) { for( j&nb
http://yuncode.net/code/c_5093587f5dbaf9该文章使用递归可以寻找出路径,但并未寻找出所有的路径。#include <stdio.h> #include <stdlib.h> void visit ( int, int ); int maze[7][7]&
#include<stdio.h> #include<stdlib.h> #include<ctype.h> #define STACK_INIT_SIZE 20 #define STACKINCREMENT 10 typedef struct{ char *top; char *bas
有一个在给定字符串中查找子串的函数strstr,该函数从给定的字符串src中查找substr并返回一个整数,指明substr第一次出现的位置(从0开始计数),如果找不到则返回-1。 要求: 1、实现该函数。 2、为该函数设计与实现单元测试。 说明: 1、代码中不允许使用系统已有的库函数,所有用到的库函数都需要自己实现 2、允许使用任何编程语言,函数原型自行给定。参考的C语言函数原型为 i
#include<iostream>#include<cmath>int prime(int n){bool flag=true;int i;for(i=2;i<int(n/2)+1;i++)if(n%i==0)flag=false;return flag;}int main(){int i,j,result=1,z;int a[21]={0},b[21]={0};f
Copyright © 2005-2025 51CTO.COM 版权所有 京ICP证060544号