上下文無關文法(Context-Free Grammar, CFG)是一個4元組G=(V, T, S, P),其中,V和T是不相交的有限集,S∈V,P是一組有限的產生式規則集,形如A→α,其中A∈V,且α∈(V∪T)*。V的元素稱為非終結符,T的元素稱為終結符,S是一個特殊的非終結符,稱為文法開始符。 設G=(V, T, S, P)是一個CFG,則G產生的語言是所有可由G產生的字符串組成的集合,即L(G)={x∈T* | Sx}。一個語言L是上下文無關語言(Context-Free Language, CFL),當且僅當存在一個CFG G,使得L=L(G)。 *⇒ 例如,設文法G:S→AB A→aA|a B→bB|b 則L(G)={a^nb^m | n,m>=1} 其中非終結符都是大寫字母,開始符都是S,終結符都是小寫字母。
標簽: Context-Free Grammar CFG
上傳時間: 2013-12-10
上傳用戶:gaojiao1999
一:需求分析 1. 問題描述 魔王總是使用自己的一種非常精練而抽象的語言講話,沒人能聽懂,但他的語言是可逐步解釋成人能聽懂的語言,因為他的語言是由以下兩種形式的規則由人的語言逐步抽象上去的: ----------------------------------------------------------- (1) a---> (B1)(B2)....(Bm) (2)[(op1)(p2)...(pn)]---->[o(pn)][o(p(n-1))].....[o(p1)o] ----------------------------------------------------------- 在這兩種形式中,從左到右均表示解釋.試寫一個魔王語言的解釋系統,把 他的話解釋成人能聽得懂的話. 2. 基本要求: 用下述兩條具體規則和上述規則形式(2)實現.設大寫字母表示魔王語言的詞匯 小寫字母表示人的語言的詞匯 希臘字母表示可以用大寫字母或小寫字母代換的變量.魔王語言可含人的詞匯. (1) B --> tAdA (2) A --> sae 3. 測試數據: B(ehnxgz)B 解釋成 tsaedsaeezegexenehetsaedsae若將小寫字母與漢字建立下表所示的對應關系,則魔王說的話是:"天上一只鵝地上一只鵝鵝追鵝趕鵝下鵝蛋鵝恨鵝天上一只鵝地上一只鵝". | t | d | s | a | e | z | g | x | n | h | | 天 | 地 | 上 | 一只| 鵝 | 追 | 趕 | 下 | 蛋 | 恨 |
上傳時間: 2014-12-02
上傳用戶:jkhjkh1982
設計一套完整實用的RSA文件加密解決方案,具體編碼實現。對RSA算法進行研究,從常規RSA算法出發,用C++實現RSA加密算法類庫,并在32位windows ... 使用VC編寫的文件操作類FileTool,主要有四個函數: //加密文件,輸入參數為文件名,采用了BlowFish加密算法
上傳時間: 2013-12-17
上傳用戶:hakim
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
MPEG4論文,MPEG4編碼算法的研究及基于DM642的優化實現
上傳時間: 2014-11-09
上傳用戶:ryb
The XML Toolbox converts MATLAB data types (such as double, char, struct, complex, sparse, logical) of any level of nesting to XML format and vice versa. For example, >> project.name = MyProject >> project.id = 1234 >> project.param.a = 3.1415 >> project.param.b = 42 becomes with str=xml_format(project, off ) "<project> <name>MyProject</name> <id>1234</id> <param> <a>3.1415</a> <b>42</b> </param> </project>" On the other hand, if an XML string XStr is given, this can be converted easily to a MATLAB data type or structure V with the command V=xml_parse(XStr).
標簽: converts Toolbox complex logical
上傳時間: 2016-02-12
上傳用戶:a673761058
java開發的五子棋游戲,為課程作業,其中關于判斷輸贏的算法可以研究
標簽: java
上傳時間: 2014-01-14
上傳用戶:chongcongying
ACM里面一道題目,Gone Fishing,也是算法分析研究的題型,就是如何在各個釣魚點進行排列,然后可以獲得最多的魚
標簽: ACM
上傳時間: 2016-06-01
上傳用戶:520
并行計算機的出現,一方面給實時信號處理、大規模科學與工程計算等提供了很好的物質基礎與機遇,另一方面又給用戶帶來 了很多新問題和困難.由于并行機種類繁多、互不通用,如何發揮并行機的效率是用戶最關心酌問題.一臺性能很高的并行機,如果不能充分發揮其效率,性能會呈數量級下降.因此并行算法的研究是并行計算的一個關鍵問題.要設計出好的并行算法,必須 對并行計算機的硬件系統、軟件系統有足夠的了解,讓設計的并行算法適合特定的硬件和軟件系統.本章對并行計算機的體系結 構、并行編程環境、并行算法的一些基本概念、并行計算的現狀及發展趨勢等作了介紹.
標簽: 并行計算機
上傳時間: 2014-11-28
上傳用戶:heart520beat
現代數字信號處理的期末作業,一種關于過零算法的研究
標簽: 數字信號處理
上傳時間: 2014-01-07
上傳用戶:epson850