-
設B是一個n×n棋盤,n=2k,(k=1,2,3,…)。用分治法設計一個算法,使得:用若干個L型條塊可以覆蓋住B的除一個特殊方格外的所有方格。其中,一個L型條塊可以覆蓋3個方格。且任意兩個L型條塊不能重疊覆蓋棋盤
標簽:
上傳時間:
2013-12-16
上傳用戶:腳趾頭
-
鍵盤任意輸入一個稀疏矩陣A(m*n),采用三元組存儲方法求其轉置矩陣B(n*m),并用快速轉置算法實現該操作。
標簽:
鍵盤
輸入
稀疏
矩陣
上傳時間:
2013-12-08
上傳用戶:lingzhichao
-
圖論中最小生成樹Kruskal算法 及畫圖程序 M-函數
格式 [Wt,Pp]=mintreek(n,W):n為圖頂點數,W為圖的帶權鄰接矩陣,不構成邊的兩頂點之間的權用inf表示。顯示最小生成樹的邊及頂點, Wt為最小生成樹的權,Pp(:,1:2)為最小生成樹邊的兩頂點,Pp(:,3)為最小生成樹的邊權,Pp(:,4)為最小生成樹邊的序號 附圖,紅色連線為最小生成樹的圖
例如
n=6 w=inf*ones(6)
w(1,[2,3,4])=[6,1,5] w(2,[3,5])=[5,3]
w(3,[4,5,6])=[5,6,4] w(4,6)=2 w(5,6)=6
[a,b]=mintreek(n,w)
標簽:
mintreek
Kruskal
Wt
Pp
上傳時間:
2015-11-30
上傳用戶:dreamboy36
-
本題的算法中涉及的三個函數:
double bbp(int n,int k,int l) 其中n為十六進制位第n位,k取值范圍為0到n+7,用來計算16nS1,16nS2,16nS3,16nS4小數部分的每一項。返回每一項的小數部分。
void pi(int m,int n,int p[]) 計算從n位開始的連續m位的十六進制數字。其中p為存儲十六進制數字的數組。
void div(int p[])
void add(int a[],int b[]) 這兩個函數都是為最后把十六進制數字轉換為十進制數字服務的。
最后把1000個數字分別存儲在整型數組r[]中,輸出就是按順序輸出該數組。
標簽:
int
double
bbp
算法
上傳時間:
2014-01-05
上傳用戶:xcy122677
-
We have a group of N items (represented by integers from 1 to N), and we know that there is some total order defined for these items. You may assume that no two elements will be equal (for all a, b: a<b or b<a). However, it is expensive to compare two items. Your task is to make a number of comparisons, and then output the sorted order. The cost of determining if a < b is given by the bth integer of element a of costs (space delimited), which is the same as the ath integer of element b. Naturally, you will be judged on the total cost of the comparisons you make before outputting the sorted order. If your order is incorrect, you will receive a 0. Otherwise, your score will be opt/cost, where opt is the best cost anyone has achieved and cost is the total cost of the comparisons you make (so your score for a test case will be between 0 and 1). Your score for the problem will simply be the sum of your scores for the individual test cases.
標簽:
represented
integers
group
items
上傳時間:
2016-01-17
上傳用戶:jeffery
-
單純形法算法,int K,M,N,Q=100,Type,Get,Let,Et,Code[50],XB[50],IA,IAA[50],Indexg,Indexl,Indexe
float Sum,A[50][50],B[50],C[50]
標簽:
50
Indexg
Indexe
Indexl
上傳時間:
2013-12-22
上傳用戶:頂得柱
-
我完善了DDK里面的StorageEnum的例程,可以枚舉并讀出USB設備的VID,PID信息(可參看附件中的圖片storageNum.JPG),關鍵點是ClassGuid的定義,這個可是困擾N多人的問題哦。
標簽:
StorageEnum
DDK
上傳時間:
2016-02-09
上傳用戶:haohaoxuexi
-
Floyd-Warshall算法描述
1)適用范圍:
a)APSP(All Pairs Shortest Paths)
b)稠密圖效果最佳
c)邊權可正可負
2)算法描述:
a)初始化:dis[u,v]=w[u,v]
b)For k:=1 to n
For i:=1 to n
For j:=1 to n
If dis[i,j]>dis[i,k]+dis[k,j] Then
Dis[I,j]:=dis[I,k]+dis[k,j]
c)算法結束:dis即為所有點對的最短路徑矩陣
3)算法小結:此算法簡單有效,由于三重循環結構緊湊,對于稠密圖,效率要高于執行|V|次Dijkstra算法。時間復雜度O(n^3)。
考慮下列變形:如(I,j)∈E則dis[I,j]初始為1,else初始為0,這樣的Floyd算法最后的最短路徑矩陣即成為一個判斷I,j是否有通路的矩陣。更簡單的,我們可以把dis設成boolean類型,則每次可以用“dis[I,j]:=dis[I,j]or(dis[I,k]and dis[k,j])”來代替算法描述中的藍色部分,可以更直觀地得到I,j的連通情況。
標簽:
Floyd-Warshall
Shortest
Pairs
Paths
上傳時間:
2013-12-01
上傳用戶:dyctj
-
該程序主要完成以下工作:
* 1、生成兩個發送線程s1,s2和一個接收線程r;
* 2、接收線程r每接收到M個來自于s1的數據和N個s2的數據后將它們分別求平均值后輸出;
* 3、這樣的接收過程總共進行3次。
標簽:
程序
發送
線程
上傳時間:
2016-02-18
上傳用戶:xg262122
-
編寫一個用SOR法解方程組Ax=b的計算機程序,其中
要求程序中不存系數A,分別對不同的階數(例如n=15,80)取w=1.7,1.8,1.9,進行迭代,記錄近似解 達到 時所用迭代次數k,觀察松弛因子對收斂速度的影響。
標簽:
SOR
Ax
編寫
方程
上傳時間:
2013-12-25
上傳用戶:wcl168881111111