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
、該個詞法分析器要求至少能夠識別以下幾類單詞: a. 關鍵字:else if int return void while共6個,所有的關鍵字都是保留字,并且必須是小寫; b. 標識符:識別與C語言詞法規定相一致的標識符,通過下列正則表達式定義:ID = letter (letter | digit)*; c. 常數:NUM=(+ | - |ε)digit digit*(.digit digit* |ε)(e(+ | - |ε) digit digit* |ε),letter = a|..|z|A|..|Z|,digit = 0|..|9,包括整數,如123, -123, +123等;小數,如123.45, +123.45, -123.45;科學計數法表示的常數,如+1.23e3,-2.3e-9; d. 專用符號:+ - * / < <= > >= == != = , ( ) [ ] { } /* */;
上傳時間: 2013-12-08
上傳用戶:gtf1207
控制流語句if-else-end,并且用學生成績舉例,創建Hilbert矩陣,n階魔方矩陣,編寫一個M函數文件
標簽: if-else-end 控制流
上傳時間: 2014-01-07
上傳用戶:jkhjkh1982
溫度華氏轉變攝氏 #include <stdio.h> #include <stdlib.h> enum x {A,B,C,D,E} int main(void) { int a=73,b=85,c=66 { if (a>=90) printf("a=A等級!!\n") else if (a>=80) printf("73分=B等級!!\n") else if (a>=70) printf("73分=C等級!!\n") else if (a>=60) printf("73分=D等級!!\n") else if (a<60) printf("73分=E等級!!\n") } { if (b>=90) printf("b=A等級!!\n") else if (b>=80) printf("85分=B等級!!\n") else if (b>=70) printf("85分=C等級!!\n") else if (b>=60) printf("85分=D等級!!\n") else if (b<60) printf("85分=E等級!!\n") } { if (c>=90) printf("c=A等級!!\n") else if (c>=80) printf("66分=B等級!!\n") else if (c>=70) printf("66分=C等級!!\n") else if (c>=60) printf("66分=D等級!!\n") else if (c<60) printf("66分=E等級!!\n") } system("pause") return 0 }
上傳時間: 2014-11-10
上傳用戶:wpwpwlxwlx
溫度華氏轉變攝氏 #include <stdio.h> #include <stdlib.h> enum x {A,B,C,D,E} int main(void) { int a=73,b=85,c=66 { if (a>=90) printf("a=A等級!!\n") else if (a>=80) printf("73分=B等級!!\n") else if (a>=70) printf("73分=C等級!!\n") else if (a>=60) printf("73分=D等級!!\n") else if (a<60) printf("73分=E等級!!\n") } { if (b>=90) printf("b=A等級!!\n") else if (b>=80) printf("85分=B等級!!\n") else if (b>=70) printf("85分=C等級!!\n") else if (b>=60) printf("85分=D等級!!\n") else if (b<60) printf("85分=E等級!!\n") } { if (c>=90) printf("c=A等級!!\n") else if (c>=80) printf("66分=B等級!!\n") else if (c>=70) printf("66分=C等級!!\n") else if (c>=60) printf("66分=D等級!!\n") else if (c<60) printf("66分=E等級!!\n") } system("pause") return 0 }
上傳時間: 2013-12-12
上傳用戶:亞亞娟娟123
Problem B:Longest Ordered Subsequence A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence (a1, a2, ..., aN) be any sequence (ai1, ai2, ..., aiK), where 1 <= i1 < i2 < ... < iK <= N. For example, sequence (1, 7, 3, 5, 9, 4, 8) has ordered subsequences, e. g., (1, 7), (3, 4, 8) and many others. All longest ordered subsequences are of length 4, e. g., (1, 3, 5, 8).
標簽: Subsequence sequence Problem Longest
上傳時間: 2016-12-08
上傳用戶:busterman
Bing is a point-to-point bandwidth measurement tool (hence the b ), based on ping. Bing determines the real (raw, as opposed to available or average) throughput on a link by measuring ICMP echo requests roundtrip times for different packet sizes for each end of the link
標簽: Bing point-to-point measurement determines
上傳時間: 2015-09-15
上傳用戶:lgnf
* "Copyright (c) 2006 Robert B. Reese ("AUTHOR")" * All rights reserved. * (R. Reese, reese@ece.msstate.edu, Mississippi State University) * IN NO EVENT SHALL THE "AUTHOR" BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE "AUTHOR" * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
上傳時間: 2015-09-24
上傳用戶:mpquest
Visual Basic 6.0可以通過調用API函數格式化一個磁盤,無論是軟盤還是硬盤。 打開一個新的項目(工程1) ,如果你沒有更改過缺省模式,那么Visual Basic 6.0會自動添加一個form1文件,在form1上添加一個命令控件,將下面的代碼拷入。 Option Explicit Private Declare Function SHFormatDrive Lib"shell32"( ByVal Hend AS Long,ByVal Drive AS Long,ByVal FormatID AS Long,ByVal Options AS Long) as Long Private Sub FormatDisk(intDrive as integer,blnQuickFormat as Boolean) dim lngReturn As Long if (blnQuickFormat) then lngReturn= SHFormatDrive(0,intDrive,0&,1&) else lngReturn= SHFormatDrive(0,intDrive,0&,0&) end if end Sub Private Sub Command1_Click() call FormatDisk(0,True) End Sub 運行此程序。 注意FormatDisk函數的第一個變量很重要,他的值是0,1,2時代表格式化的分別是:A、B、C盤。
上傳時間: 2015-10-05
上傳用戶:kytqcool
About: hamsterdb is a database engine written in ANSI C. It supports a B+Tree index structure, uses memory mapped I/O (if available), supports cursors, and can create in-memory databases. Release focus: Major feature enhancements Changes: This release comes with many changes and new features. It can manage multiple databases in one file. A new flag (HAM_LOCK_EXCLUSIVE) places an exclusive lock on the file. hamsterdb was ported to Windows CE, and the Solution file for Visual Studio 2005 now supports builds for x64. Several minor bugs were fixed, performance was improved, and small API changes occurred. Pre-built libraries for Windows (32-bit and 64-bit) are available for download. Author: cruppstahl
標簽: C. hamsterdb structure database
上傳時間: 2013-12-11
上傳用戶:LouieWu