自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(92)
  • 收藏
  • 关注

转载 八皇后

转载:http://zhedahht.blog.163.com/blog/static/2541117420114331616329   解决这个问题通常需要用递归,而递归对编程能力的要求比较高。因此有不少面试官青睐这个题目,用来考察应聘者的分析复杂问题的能力以及编程的能力。   由于八个皇后的任意两个不能处在同一行,那么肯定是每一个皇后占据一行。于是我们可以定义一个数组colum

2015-12-29 11:37:06 586

原创 二叉搜索树BST

在二叉搜索树b中查找x的过程为:1.若b是空树,则搜索失败,否则:2.若x等于b的根结点的数据域之值,则查找成功;否则3.若x小于b的根结点的数据域之值,则搜索左子树:否则4.查找右子树// 指针parent指向pRoot的父节点,其初始调用值为NULL// 若查找成功,指针pTarget指向目标节点,函数返回true// 否则指针pTarget指向查找路径上访问的最后一个

2015-12-27 22:46:15 585

原创 指向指针的指针和指针的引用

当我们把一个指针作为一个参数传递给函数时,其实是把指针的copy传递给了函数,也可以说传递指针是指针的值传递。如果我们在函数内部修改指针,修改的只是指针的copy而不是指针本身。代码验证如下:#includeusing namespace std;int num1 = 1;void func(int* p){ p = &num1; cout << p << endl;

2015-12-26 11:58:49 756

原创 归并排序

先递归分解序列,再合并有序数列#include #include #include using namespace std;#define random(x) (rand()%x)void merge_array(int nums[], int first, int mid, int last, int temp[]){ int index1 = first, index2

2015-12-23 10:44:22 516

原创 堆排序

#include #include #include using namespace std;#define random(x) (rand()%x)void heap_adjust(vector& nums, int index, int length){ for(int i = 2 * index; i <= length; i *= 2) { int temp =

2015-12-06 23:15:15 611

原创 快速排序

2015.11.30 面试创云传奇#include #include #include using namespace std;#define random(x) (rand()%x)void quick_sort(vector& vec, int left, int right){ if(left < right) { int pivot = vec[left];

2015-12-06 17:30:19 476

原创 单链表快速排序

2015.11.27  面试一点资讯 ,面试官是很nice的校友师兄,无奈基本功太差,跪了!#include using namespace std;#define random(x) (rand()%x)struct ListNode{ int value; ListNode* next;};void create_list(ListNode* head){ Li

2015-11-28 11:26:20 828 1

原创 UVaOJ 127

`Accordian'' Patience You are to simulate the playing of games of ``Accordian'' patience, the rules for which are as follows:Deal cards one by one in a row from left to right, not ov

2014-09-21 10:20:49 789

原创 算法:C语言实现第三章第一节学习笔记

3.1

2014-08-22 18:06:31 777

原创 C程序设计语言(K&R)第七章学习笔记

7.1     符号常量EOF、

2014-08-14 19:55:04 735

原创 C程序设计语言(K&R)第六章学习笔记

6.1结构

2014-08-07 19:12:17 857

原创 C程序设计语言(K&R)第五章学习笔记

5.1    一元运算fu

2014-08-02 15:01:21 985

原创 C程序设计语言(K&R)第四章学习笔记

#include #include #define MAXLINE 100/* rudimentary calculator */int main(){ double sum, atof(char []); char line[MAXLINE]; int getline(char line[], int max); sum = 0; while (getline(line

2014-08-01 20:40:52 765

原创 C程序设计语言(K&R)第三章学习笔记

3.5

2014-07-31 19:49:08 693

原创 C程序设计语言(K&R)第二章学习笔记

char s[];

2014-07-30 20:39:35 736

原创 C++中.h和.cpp的关系

C++中,一般把类的定义放到tou

2014-07-29 09:24:09 9321

原创 C程序设计语言(K&R)第一章学习笔记

#include /*print Fahrenheit-Celsius table for fahr=0,20,...,300;floating-point version*/int main(){ float fahr,celsius; float lower,upper,step; lower = 0; /*lower limit of tempera

2014-07-28 20:48:30 1250

原创 容器

容器是用来存储和组织

2014-07-28 15:59:22 715

原创 typedef

用typedef声明一个新的类型名来代替已有的类型名type

2014-07-27 11:05:11 703

原创 类模板

template

2014-07-26 09:55:22 617

原创 指针

指针可与非指针变量一起说明

2014-07-26 09:53:43 534

原创 srand()函数

srand()函数是随机数发生器的初始化函数yuanx

2014-07-23 17:08:59 840

原创 time()函数

函数原型:time_t

2014-07-23 16:55:26 1060

原创 算法竞赛入门经典6.2.1

#include #define maxn 50000+10int A[maxn];int find(int A[],int x);void shift_circular_left(int A[],int p,int q);void shift_circular_right(int A[],int q,int p);int main(){ int n,m; int X,Y; i

2014-07-23 15:47:05 759

原创 数组作为函数参数

1.数组元素作为函数实参与bianl

2014-07-22 20:02:51 1022

原创 队列

队列在程序设计中经常出现,一个最典型的例子就是操作xi

2014-07-19 09:15:45 590

原创 stack

#include头文件,STL中很有用的容器适配器之一,默认jiyu

2014-07-18 22:35:00 611

原创 UVaOJ 10474 大理石在哪?

Where is the Marble? Raju and Meena love to play with Marbles. They have got a lot of marbles with numbers written on them. At the beginning, Raju would place the marbles one after anoth

2014-07-18 10:37:03 751

原创 UvaOJ 10420 战利品列表

#include #include #include #define maxn 2000+10#define N 75+10char ss[N];char country[maxn][maxn];int cmp(const void *_a,const void *_b);int main(){ int n,i; int len; int total,q=0; scanf

2014-07-17 22:24:10 590

原创 UVaOJ 340 猜数字游戏的提示

#include #define maxn 1000+10using namespace std;int secret[maxn],cp_secret[maxn],guess[maxn];void judge(int secret[],int guess[],int n,int &a,int &b);int main(){ int n,a,b,cnt=1; while(cin>>

2014-07-17 19:38:43 895

原创 UvaOJ 424 整数查询

#include #include #define maxn 100+10#define INF 1e9char str[maxn][maxn];int num[maxn][maxn];int ans[maxn];int main(){ int i=0,j; int count,len,max=-INF,flag; while(~scanf("%s",str[i]))/

2014-07-16 15:14:12 683

原创 UVa OJ 537 人工智能

Physics teachers in high school often think that problems given as text are more demanding than pure computations. After all, the pupils have to read and understand the problem first!So they don't

2014-07-15 20:18:22 1287

原创 UVa OJ 10361 自动作诗机

#include #include int main(){int n,i;char ch[4][100],temp;scanf("%d",&n);getchar();while(n--){for(i=0;imemset(ch[i],0,sizeof(ch[i]));for(i=0;(temp=getchar())!='putcha

2014-07-14 15:40:13 873

原创 UVa OJ 回文词(401)

/*******************************************Problem:UVA OJ-401 PalindromesDate:11/07/2014Author:Praker********************************************/#include #include #define maxn 10000char str

2014-07-12 11:25:44 784

原创 C++如何输入多行字符串(含空格)

#include #include using namespace std;int main(){ string s; int n; cin>>n; for(int i=0;i<n;i++) { cin>>s; cout<<s<<endl; } return 0;}

2014-07-10 18:58:52 47164 1

原创 字母重排

#include #include #include int n;char word[2000][10],sorted[2000][10];//字符比较函数int cmp_char(const void* _a,const void* _b){ char* a=(char*)_a; char* b=(char*)_b; return *a-*b;}//字符串比较函数

2014-07-08 19:48:20 1002

原创 字符串比较函数strcmp

strcmp(const char[],const char[]);

2014-07-08 18:45:32 3148

原创 qsort

编译器函数库自带的

2014-07-08 16:22:38 658

原创 6174问题

#include #include int num[2000],count;int get_next(int x);int main(){ scanf("%d",&num[0]); printf("%d",num[0]); count =1; for(;;) { num[count]=get_next(num[count-1]);//生成并输出下一个数 printf(

2014-07-08 14:52:40 635

原创 高精度运算类bign

大数据操作yo

2014-07-07 19:20:11 1605

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除