2015年7月6日

P,NP,NPC的通俗解释

摘要: 这或许是众多OIer最大的误区之一。你会经常看到网上出现“这怎么做,这不是NP问题吗”、“这个只有搜了,这已经被证明是NP问题了”之类的话。你要知道,大多数人此时所说的NP问题其实都是指的NPC问题。他们没有搞清楚NP问题和NPC问题的概念。NP问题并不是那种“只有搜才行”的问题,NPC问题才是。好... 阅读全文

posted @ 2015-07-06 17:13 Alex0111 阅读(1496) 评论(0) 推荐(0)

考研编程练习----Kruskal

摘要: #include <stdio.h> #include <stdlib.h> #define MAX 100 /* 定义边(x,y),权为w */ typedef struct { int x, y; int w; }edge; edge e[MAX]; /* rank[x]表示x的秩 */ int 阅读全文

posted @ 2015-07-06 15:35 Alex0111 阅读(269) 评论(0) 推荐(0)

考研编程练习----swap

摘要: void swap(int a ,int b){ a^=b; b^=a; //b =b^a^b //b = b^b^a;//b = a; 按位异或满足交换律 a^=b; //a = a^b^a //a = a^a^b;//a = b;} 阅读全文

posted @ 2015-07-06 14:35 Alex0111 阅读(149) 评论(0) 推荐(0)

考研编程练习----快速排序

摘要: voidsort(int*a,intleft,intright){if(left>=right)/*如果左边索引大于或者等于右边的索引就代表已经整理完成一个组了*/{return;}inti=left;intj=right;intkey=a[left];while(i=a[i])/*这是i在当组内向... 阅读全文

posted @ 2015-07-06 14:30 Alex0111 阅读(173) 评论(0) 推荐(0)

导航