Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

×îСÉú³ÉÊ÷µÄKruskalËã·¨(C/C++) ¸½ÓвâÊÔÊý¾ÝºÍ½á¹û

/*
*Ëã·¨Ô­Àí£º½«Í¼G Öеı߰´È¨Êý´ÓСµ½´óÖðÌõ¿¼²ì,
* °´²»¹¹³ÉȦµÄÔ­Ôò¼ÓÈëµ½TÖÐ(ÈôÓÐÑ¡Ôñʱ, ²»Í¬µÄÑ¡
* Ôñ¿ÉÄܻᵼÖÂ×îºóÉú³ÉÊ÷µÄȨÊý²»Í¬), Ö±µ½
* q(T) = p(G)-1Ϊֹ, ¼´ T µÄ±ßÊý = G µÄ¶¥µã1 Ϊֹ.
*Ëã·¨ÖÐÎÞȦÐÔµÄÅж¨±È½ÏÂé·³£¬Ó¦¸ÃÓñê¼Ç·¨×îºÃ£¬
*¶Ô¸÷¸ö·ÖÖ§µÄ¶¥µã±êºÅ¡£
*ÎÒû×Ðϸ¿´Ê飬ÆäʵÊéÉÏдµÃºÜÇå³þ£¬ÊÇÀÏʦÌáÐÑµÄ ^_^ ¡£
*²Î¿¼Ê飺2004£¬¡¶Í¼ÂÛ¼°ÆäÓ¦Óá·£¬¿Æѧ³ö°æÉ磬Ëï»ÝȪ ±àÖø¡£
*/
#include<iostream>
#include<fstream>
#define N 100
using namespace std;
int n;//½áµãÊý
int a[N][N] = {0};
bool judgeNode(int flagNodes[N]){//ÅжÏÊÇ·ñ»¹ÓÐδ·ÃÎʽáµã
for(int i = 0; i < n; i++)
if(flagNodes[i] == 0) return 1;
return 0;
}
void judgeSub(int flagSub[N], int x, int y){//±ê¼Ç·ÖÖ§
if(flagSub[x] != 0){
if(flagSub[y] == 0) flagSub[y] = flagSub[x];
else{
int min = flagSub[x] < flagSub[y] ? flagSub[x] : flagSub[y];
int max = flagSub[x] + flagSub[y] - min;
for(int i = 0; i < n; i++)
if(flagSub[i] == max)
flagSub[i] = min;
}
}
else{
if(flagSub[y] == 0){
int max = 0;
for(int i = 0; i < n; i++){
if(flagSub[i] != 0 && flagSub[i] > max)
max = flagSub[i];
}
flagSub[x] = flagSub[y] = ++max;
}
else flagSub[x] = flagSub[y];
}
}
bool judgeCircle(int flagSub[N], int x, int y){//ÅжÏÉú³ÉÊ÷ÖÐÎÞȦ
if(flagSub[x] == 0 && flagSub[y] == 0) return 1;
if(flagSub[x] != flagSub[y]) return 1;
return 0;
}
void kruskal(){
int temp[N][N] = {0};
int flagNodes[N] = {0};
int flagSub[N] = {0};
int least = N;
int x = 0, y = 0;
cout<<"The edges of Optimal tree:"<<endl;
while(judgeNode(flagNodes)){
least = N;
for(int i = 0; i < n; i++){
for(int j = i+1; j < n; j++){


Ïà¹ØÎĵµ£º

linux CÕýÔò±í´ïʽ——POSIXÕýÔò²âÊÔ

ÕâÊÇCµÄÔ­³ÌÐò
#include <stdio.h>
#include <regex.h>
int main(int argc, char** argv)
{
regex_t reg;
regmatch_t pm[10];
char *pattern;
char buf[50];
const size_t nmatch = 10;

pattern = argv[1];
int result = regcomp(®, pattern, REG_EXTENDED);
while( fgets ......

תC/C++ºÍ»ã±à»ìºÏ±à³Ì

תCºÍ»ã±à»ìºÏ±à³Ì
.dataÊdzõʼ»¯µÄÊý¾Ý¿é¡£ÕâЩÊý¾Ý°üÀ¨±àÒëʱ±»³õʼ»¯µÄglobleºÍstatic±äÁ¿£¬Ò²°üÀ¨×Ö·û´®¡£
Á¬½ÓÆ÷½«OBJs¼°LIBsÎļþµÄ.data½áºÏ³ÉÒ»¸ö´óµÄ.data¡£local±äÁ¿ÒÔ·ÅÔÚÒ»¸öÏßÐԵĶÑÕ»ÖУ¬
²»Õ¼.dataºÍ.bssµÄ¿Õ¼ä¡£ºÍ.textÒ»Ñù£¬Êý¾Ý¿éÊÇÒÔÃ÷ÎĵÄÐÎʽ´æ·ÅÔÚÎļþÖеġ£ÎÞ·¨·ÀÖ¹¶ÔÆäÎïÀíµÄÐ޸ġ£
.bssÇøÊÇ´æ· ......

C/C++Ê¥Õ½(¶þ)

ODBCºÍIDAPIÖ®Õù
µ±MicrosoftÔÚÖ𽥵Ļ÷°ÜËûµÄ¾ºÕù¶ÔÊÖ£¬²¢ÇÒÓµÓÐÁ˴󲿷ÝPCÊý¾Ý¿âÊг¡Ö®ºó£¬±ãÂýÂýµÄÁ˽⵽ÕÆÎÕ±ê×¼µÄÖØÒªÐÔ¡£´ËÍâMicrosoftΪÁËͳһ¸÷Ó¦ÓóÌÐòÖ®¼ä²»Í¬×ÊÁϵĴæÈ¡£¬Òò´Ë¿ªÊ¼Öƶ¨´æÈ¡×ÊÁϵÄͳһ±ê×¼-ODBC¡£Microsoft¸ü´óµÄÄ¿µÄÊÇΪÁË×¼±¸ºÍÃé×¼ÏÂÒ»³¡µÄ´óÕ½£¬ÄǾÍÊÇPCÉϵÄRDBMS²úÆ·¡£µ±È»Microsoft Ҫһͳ ......

C/C++ÓëJava¶àάÊý×飬±éÀúÓë×î´óÖµ»ñÈ¡·½·¨£¡

C/C++
/*
* File: main.cpp
* Author: Vicky
*
* Created on 2010Äê4ÔÂ29ÈÕ, ÉÏÎç9:46
*/
#include <iostream>
using namespace std;
int maximum(int[], int);
int main(int argc, char** argv) {
// int sg[3][4] = {
int sg[][4] = {
{68, 77, 73, 86},
{87, 96, 7 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ