叉排序樹與平衡二叉排序樹基本操作的實現(xiàn) 用二叉鏈表作存儲結(jié)構(gòu) (1)以回車( \n )為輸入結(jié)束標志,輸入數(shù)列L,生成二叉排序樹T; (2)對二叉排序樹T作中序遍歷,輸出結(jié)果; (3)計算二叉排序樹T的平均查找長度,輸出結(jié)果; (4)輸入元素x,查找二叉排序樹T,若存在含x的結(jié)點,則刪除該結(jié) 點,并作中序遍歷(執(zhí)行操作2);否則輸出信息“無結(jié)點x”; (5)判斷二叉排序樹T是否為平衡二叉樹,輸出信息“OK!”/“NO!”;
標簽: 排序 樹 基本操作 存儲結(jié)構(gòu)
上傳時間: 2013-12-23
上傳用戶:wab1981
上下文無關(guān)文法(Context-Free Grammar, CFG)是一個4元組G=(V, T, S, P),其中,V和T是不相交的有限集,S∈V,P是一組有限的產(chǎn)生式規(guī)則集,形如A→α,其中A∈V,且α∈(V∪T)*。V的元素稱為非終結(jié)符,T的元素稱為終結(jié)符,S是一個特殊的非終結(jié)符,稱為文法開始符。 設(shè)G=(V, T, S, P)是一個CFG,則G產(chǎn)生的語言是所有可由G產(chǎn)生的字符串組成的集合,即L(G)={x∈T* | Sx}。一個語言L是上下文無關(guān)語言(Context-Free Language, CFL),當且僅當存在一個CFG G,使得L=L(G)。 *⇒ 例如,設(shè)文法G:S→AB A→aA|a B→bB|b 則L(G)={a^nb^m | n,m>=1} 其中非終結(jié)符都是大寫字母,開始符都是S,終結(jié)符都是小寫字母。
標簽: Context-Free Grammar CFG
上傳時間: 2013-12-10
上傳用戶:gaojiao1999
一臺精密儀器的工作時間為 n 個時間單位。與儀器工作時間同步進行若干儀器維修程序。一旦啟動維修程序,儀器必須進入維修程序。如果只有一個維修程序啟動,則必須進入該維修程序。如果在同一時刻有多個維修程序,可任選進入其中的一個維修程序。維修程序必須從頭開始,不能從中間插入。一個維修程序從第s個時間單位開始,持續(xù) t個時間單位,則該維修程序在第s+t-1個時間單位結(jié)束。為了提高儀器使用率,希望安排盡可能少的維修時間。
上傳時間: 2013-12-20
上傳用戶:pkkkkp
This archive includes the Delphi component TScreenCapture (D3,D4,D5) that implements an interface to the capture DLL of our screen capture tool "T.N.T".
標簽: TScreenCapture implements component interface
上傳時間: 2015-09-24
上傳用戶:dreamboy36
生成Bipartite Graphs ./distributions -u -m 1 -M 10 -n 100 -s 500 > top_distrib ./distributions -p -2.2 -m 1 -M 100 -n 200 -s 500 > bottom_distrib ./random_bipartite -t top_distrib -b bottom_distrib > bn_test
標簽: distributions top_distrib Bipartite Graphs
上傳時間: 2015-10-02
上傳用戶:yy541071797
--- --- --- ----UART0: 115200,8,n,1------------------------------- Embest S3CEV40 >Embest Info&Tech Co., Ltd. Embest Info&Tech Co., Ltd. Embest S3CEV40 >
上傳時間: 2013-11-30
上傳用戶:wqxstar
假定已經(jīng)有許多應(yīng)用采用了程序1 - 1 5中所定義的C u r r e n c y類,現(xiàn)在我們想要對C u r r e n c y類 的描述進行修改,使其應(yīng)用頻率最高的兩個函數(shù)A d d和I n c r e m e n t可以運行得更快,從而提高應(yīng) 用程序的執(zhí)行速度。由于用戶僅能通過p u b l i c部分所提供的接口與C u r r e n c y類進行交互,
上傳時間: 2015-10-11
上傳用戶:BIBI
鄰接矩陣類的根是A d j a c e n c y W D i g r a p h,因此從這個類開始。程序1 2 - 1給出了類的描述。程 序中,先用程序1 - 1 3中函數(shù)Make2DArray 為二組數(shù)組a 分配空間,然后對數(shù)組a 初始化,以描述 一個n 頂點、沒有邊的圖的鄰接矩陣,其復(fù)雜性為( n2 )。該代碼沒有捕獲可能由M a k e 2 D A r r a y 引發(fā)的異常。在析構(gòu)函數(shù)中調(diào)用了程序1 - 1 4中的二維數(shù)組釋放函數(shù)D e l e t e 2 D
標簽: 矩陣
上傳時間: 2013-12-21
上傳用戶:lanjisu111
HDOJ ACM input:The input consists of T test cases. The number of test cases ) (T is given in the first line of the input. Each test case begins with a line containing an integer N , 1<=N<=200 , that represents the number of tables to move. Each of the following N lines contains two positive integers s and t, representing that a table is to move from room number s to room number t (each room number appears at most once in the N lines). From the N+3-rd line, the remaining test cases are listed in the same manner as above.
上傳時間: 2015-10-18
上傳用戶:三人用菜
Input The first line of the input contains a single integer T (1 <= T <= 20), the number of test cases. Then T cases follow. The first line of each case contains N, and the second line contains N integers giving the time for each people to cross the river. Each case is preceded by a blank line. There won t be more than 1000 people and nobody takes more than 100 seconds to cross. Output For each test case, print a line containing the total number of seconds required for all the N people to cross the river. Sample Input 1 4 1 2 5 10 Sample Output 17
標簽: the contains integer number
上傳時間: 2015-10-27
上傳用戶:plsee
蟲蟲下載站版權(quán)所有 京ICP備2021023401號-1