月日旅游與酒店管理學院酒店Q_第1頁
月日旅游與酒店管理學院酒店Q_第2頁
月日旅游與酒店管理學院酒店Q_第3頁
月日旅游與酒店管理學院酒店Q_第4頁
月日旅游與酒店管理學院酒店Q_第5頁
已閱讀5頁,還剩26頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

DiscreteMathematics

Chapter5Counting大葉大學資訊工程系黃鈴玲Ch5-2Acountingproblem:(Example15)Eachuseronacomputersystemhasapassword,whichissixtoeightcharacterslong,whereeachcharactersisanuppercaseletteroradigit.Eachpasswordmustcontainatleastonedigit.Howmanypossiblepasswordsarethere?Thissectionintroducesavarietyofothercountingproblemsthebasictechniquesofcounting.§5.1TheBasicsofcountingCh5-3BasiccountingprinciplesThesumrule:Ifafirsttaskcanbedoneinn1waysandasecondtaskinn2ways,andifthesetaskscannotbedoneatthesametime.thentherearen1+n2

waystodoeithertask.Example11Supposethateitheramemberoffacultyorastudentischosenasarepresentativetoauniversitycommittee.Howmanydifferentchoicesarethereforthisrepresentativeifthereare37membersofthefacultyand83students?n1n2n1+n2waysCh5-4Example12Astudentcanchooseacomputerprojectfromoneofthreelists.Thethreelistscontain23,15and19possibleprojectsrespectively.Howmanypossibleprojectsaretheretochoosefrom?

Sol:

23+15+19=57projects.Theproductrule:Supposethataprocedurecanbebrokendownintotwotasks.Iftherearen1waystodothefirsttaskandn2waystodothesecondtaskafterthefirsttaskhasbeendone,thentherearen1n2waystodotheprocedure.n1n2n1×n2waysCh5-5Example2Thechairofanauditorium(大禮堂)is

tobelabeledwithaletterandapositiveinteger

notexceeding100.Whatisthelargestnumberof

chairsthatcanbelabeleddifferently?Sol:

26×100=2600waystolabelchairs.

letter

Example4Howmanydifferentbitstringsarethereoflengthseven?Sol:

1

2

3

4

5

6

7□□□□□□□↑↑↑↑↑↑↑

0,10,10,1......0,1→27

種Ch5-6Example5Howmanydifferentlicenseplates(車牌)areavailableifeachplatecontainsasequenceof3lettersfollowedby3digits?Sol:□□□□□□→263.103letterdigitExample6Howmanyfunctionsaretherefromasetwithmelementstoonewithnelements?Sol:

f(a1)=?

可以是b1~bn,共n種

f(a2)=?

可以是b1~bn,共n種:

f(am)=?

可以是b1~bn,共n種∴nma1a2...a(chǎn)mb1b2...bnfCh5-7Example7Howmanyone-to-onefunctionsaretherefromasetwithm

elementstoonewithnelement?

(mn)Sol:

f(a1)=?

可以是b1~bn,共n種

f(a2)=?

可以是b1~bn,但不能=

f(a1),共n-1種

f(a3)=?

可以是b1~bn,但不能=

f(a1),也不能=f(a2),

共n-2種

::

f(am)=?

不可=f(a1),f(a2),...,f(am-1),故共n-(m-1)種∴共n.(n-1).(n-2).....(n-m+1)種1-1function#Ch5-8Example15Eachuseronacomputersystemhasapasswordwhichis6to8characterslong,whereeachcharacterisanuppercaseletteroradigit.Eachpasswordmustcontainatleastonedigit.

Howmanypossiblepasswordsarethere?Sol:

Pi:

#ofpossiblepasswordsoflengthi,i=6,7,8

P6=366-266

P7=367-267

P8=368-268

∴P6

+P7

+P8

=366+367+368-

266

-267-268種Ch5-9Example14InaversionofBasic,thenameofavariableisastringofoneortwoalphanumericcharacters,whereuppercaseandlowercaselettersarenotdistinguished.Moreover,avariablenamemustbeginwithaletterandmustbedifferentfromthefivestringsoftwocharactersthatarereservedforprogramminguse.HowmanydifferentvariablenamesarethereinthisversionofBasic?Sol:

LetVi

bethenumberofvariablenamesoflengthi.

V1=26

V2=26.36–5 ∴26+26.36–5differentnames.Ch5-10※TheInclusion-ExclusionPrinciple(排容原理)ABExample17

Howmanybitstringsoflengtheighteitherstartwitha1bitorendwiththetwobits00?Sol:

12345678□□□□□□□□↑↑......①1

0,10,1→共27種②............00→共26種③1...........00→共25種27+26-25種Ch5-1101bit1※TreeDiagrams

Example18Howmanybitstringsoflengthfourdo

nothavetwoconsecutive1s?

Sol:

Exercise:11,17,23,27,38,39,47,5300000111001(0000)(0001)(0010)(0100)(0101)(1000)(1001)(1010)∴8bitstrings00110bit3Ch5-12Ex38.Howmanysubsetsofasetwith100elementshavemorethanoneelement?Sol:

Ex39.Apalindrome(迴文)isastringwhosereversalisidenticaltothestring.Howmanybitstringsoflengthnarepalindromes?

(abcdcba是迴文,abcd不是)Sol:Ifa1a2

...anisapalindrome,then

a1=an,a2=an-1,

a3=an-2,…Thm.4of§4.3

放不放

放不放

放不放空集合及

只有1個元素的集合Ch5-13§5.2ThePigeonholePrinciple(鴿籠原理)Theorem1(ThePigeonholePrinciple)If

k+1ormoreobjectsareplacedintokboxes,thenthereisatleastoneboxcontainingtwoormoreoftheobjects.ProofSupposethatnoneofthe

kboxescontainsmorethan

oneobject.Thenthetotalnumberofobjectswouldbeatmostk.Thisisacontradiction.Example1.Amongany367people,theremustbeatleasttwowiththesamebirthday,becausethereareonly366possiblebirthdays.Ch5-14Example2Inanygroupof27Englishwords,theremustbeatleasttwothatbeginwiththesameletter.Example3Howmanystudentsmustbeinaclasstoguaranteethatatleasttwostudentsreceivethesamescoreonthefinalexam?(0~100points)Sol:

102.(101+1)Theorem2.(Thegeneralizedpigeonholeprinciple)IfN

objectsareplacedintokboxes,thenthereisatleastoneboxcontainingatleastobjects.e.g.21objects,10boxestheremustbeonebox

containingatleastobjects.Ch5-15Example5Among100peoplethereareatleastwhowereborninthesamemonth.(100objects,12

boxes)Ch5-16Example10Duringamonthwith30daysabaseballteamplaysatleast1gameaday,butnomorethan45games.Showthattheremustbeaperiodofsomenumberofconsecutivedaysduringwhichtheteammustplayexactly14games.存在一段時間的game數(shù)和=14(跳過)Ch5-17Sol:Letaj

bethenumberofgamesplayedonorbeforethejthdayofthemonth.(第1天~第j天的比賽數(shù)和)ThenisanincreasingsequenceofdistinctintegerswithMoreover,isalsoanincreasingsequenceofdistinctintegerswithThereare60positiveintegersbetween1and59.Hence,suchthat(跳過)Ch5-18Def.

Supposethatisasequenceofnumbers.Asubsequenceofthissequenceisasequenceof

theformwhere

e.g.sequence:8,11,9,1,4,6,12,10,5,7subsequence:8,9,12()9,11,4,6()Def.Asequenceiscalledincreasing

(遞增)ifAsequenceiscalled

decreasing

(遞減)ifAsequenceiscalledstrictlyincreasing

(嚴格遞增)

ifAsequenceiscalled

strictlydecreasing

(嚴格遞減)

ifCh5-19Theorem3.Everysequenceofn2+1

distinctrealnumberscontainsasubsequenceoflengthn+1thatiseitherstrictlyincreasingorstrictlydecreasing.Example12.Thesequence8,11,9,1,4,6,12,10,5,7contains10=32+1terms(i.e.,n=3).

Thereisastrictlyincreasingsubsequenceoflengthfour,namely,1,4,5,7.Thereisalsoadecreasingsubsequenceoflength4,namely,11,9,6,5.Exercise21Constructasequenceof16positiveintegersthathasnoincreasingordecreasingsubsequenceof5terms.Sol:Exercise:5,13,15,31(跳過)Ch5洪-20§5.3鏡P奇ermu標tati妹ons(排列)an孤dCo云mbin患atio惕ns(組合)Def覽.Aperm帳utat障ionofa繁set騾of強dist榮inct檢obj摘ects數(shù)is德ano蓄rder恰eda挺rran旬geme臺nto異fth共ese鴿obje瓜cts.廢An遺orde途red野arra柏ngem燥ent坐ofrelem投ents員of宴ase帳tis淋cal避led知anr-per悼muta傷tion.Exam鳥ple侍2.LetS={1,賴2,3掙}.The裕ar襯ran泰gem震ent3,1,尚2is吊ap蛾erm鋸uta脅tio敏no緒fS.燃The認ar混ran辛gem兇ent3,2isa養(yǎng)2-p叫ermu丘tati純ono醋fS.The親ore銷m1喪.The谷nu催mbe仙ro捎fr-pe墻rmu花tat傅ion好of孝a斧set經(jīng)wi完thndist陷inct冷ele峽ment襲sis位置:1狠2羊3亡…貍r□□匯□…□放法:…Ch5-21Exam信ple鉗4.How戲many銳dif盼fere翻ntw染ays譯are閘ther知eto易sel決ectafi脹rst-苦priz堡ewi棕nner司(第一名),送as朵eco確nd-傻pri鏟ze隔win久ner奶,a詠nd芒a艙th溝ird約-pr偏ize竿wi槽nne惕rf弊rom伍10汗0d扇iff牌ere思nt皮peo壘ple上wh閘oh役ave龜ent膜ere穴da夫co抹nte嗚st刪?Sol逝:Exam堅ple弄6.Supp故ose蘭that建as研ales殿woma仗nha泉sto挺vis辨it8di撥ffer柿ent鐵citi養(yǎng)es.健She郊must揚beg淘inh政ert鍬rip痛ina疫spe果cifi董ed廈city愛,bu扶tsh兄eca掌nvi義sit趙the充othe甩rci笨ties株in傳any鍛orde司rsh屑e啊wish巴es.紀How務many勢pos貍sibl湖eor桶ders丈can啦the始sal恢eswo情man垃use今whe壞nvi鄭siti徹ngt寬hese賣cit答ies欺?Sol衰:Ch5-22Def.Anr-co瓣mbi忍nat泳ionofe朱leme夫nts繳ofa掠set才is北anuno代rde喂red違se臺lec扎tio圓no絡frelem咽ents秒fro戰(zhàn)mth漢ese巴t.Exa之mpl把e9LetSbe順the只se鴨t{1,肢2,3罵,4}.鉗The贈n{1,旬3,延4}is狂a3-co千mbi圓nat趴ion蠅fr擁omS.The幻玉ore驢m2The照nu勝mbe襪ro考fr-co授mbi卡nat最ion俘so漫fa味se魔t崗wit太hnele貝men裹ts,書wh古erenis煎ap窄osi托tiv給ei片nte修ger歸an感drisan悄int糞ege破rw席ith特,攤eq萌ual貫spf:稱為binomialcoefficientCh5-23Exam徐ple住10.We仰see壯th仗atC(4,2馳)=6,sin醒ce宏the2-co伶mbin侄atio傲nso旅f{a,b,c,d}are且the斗six局subs臣ets{a,b},全{a,c},聾{a,d},{b,c},{b,d}and{c,d}Coro吼llar呈y2.Letnandrbe歲non貢neg筑ati搶ve布int夾ege概rs邊wit繩hrn.The川nC(n,r)=C(n,n-r)pf:FromThm霞2.組合意仰義:選r個拿走,相當於競是選n-r個留下.Ch5體-24Exam廈ple愉12.How炎many筑way蜘sar芒eth妨ere必tos昨elec幣t5圍play臘ers隱from裹a1窩0-me巖mber羽ten居nis曠team諷to城make五at遺rip繼toa憑mat額cha君tan奔othe劣rsc仰hool哥?Sol:C(10販,5)紅=25捐2Exam擠ple輩15.Supp骨ose疏ther克ear擱e9惜facu復lty辱memb稍ers右int港hem立ath龍depa烤rtme賤nta襯nd1招1in挪the比com緒pute桃rsc確ienc淚ede卡part晴ment匪.Ho給wma晃nyw外ays走are蘋ther拿eto鈴sel茅ect嚼a評co氣mmit謊tee宮ift佳hec狐ommi謹ttee準is篇toc葛onsi畝sto薯f3謠facu營lty示memb湊ers執(zhí)from替the蒙mat逼hde疤part挪ment斥and據(jù)4f炊rom咐the配comp醋uter隙sci啟ence賀dep協(xié)artm嚴ent?Sol:Exer錦cise私:3,覽11,再13懇,2作1,內(nèi)33,乘34慕.Ch5-25§5.烏4型B己ino環(huán)mia屠lC性oef形fic禮ien萄ts泛(二項式係趨數(shù))Exam荷ple箏1.要產(chǎn)生xy2項時,晝需從三個史括號中選位兩個括號懶提供y,剩下一醒個則提供x(注意:同研一個括號筋中的x跟y不可能相勸乘)∴共有徐種笨不同來占源的xy2∴xy2的係數(shù)=Theo椒rem螺1.(Th下eB固ino效mia荒lT君heo錯rem醬,二項式繡定理)Letx,ybev毛aria漸bles劇,an尤dle撓tnbea攜pos刃itiv認ein投tege激r,t縮慧henCh5及-26Exam凱ple橡4.What折is邪the氏coef沃fici谷ent季ofx12y13inthe互expa反nsio滑nof后?Sol泥:∴Cor竿1.Letnbea騙pos移itiv拔ein慰tege揀r.T這henpf:By駕Thm踩1,目l魄etx=y=1Cor堂2.Letnbea板pos窯itiv鐵ein的tege扭r.貿(mào)Thenpf:by綿Thm斃1.(1-1)n=0Ch5-27Theo達rem糧2.(Pa炒sca支l’s膚id姑ent視ity索)Letnandkbe記pos啞iti派ve纖int

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論