香港浸会大学:Programming Interest Group(PPT讲稿)Combinatorics & Number Theory

Programming Interest Group http://www.comp.hkbu.eduhk/-chxw/pig/index.htm Tutorial five ●●●●● Combinatorics Number Theory 8080
1 Programming Interest Group http://www.comp.hkbu.edu.hk/~chxw/pig/index.htm Tutorial Five Combinatorics & Number Theory

●●● ●●●● ●●●●● ●●●● ●●0●● Outline ●●●● ●●●● ● Combinatorics(组合) Basic Counting Techniques Recurrence relations Binomial coefficients ● Number Theory Prime number ° Congruences ● Fermat' s Theorem o Euler's Theorem
2 Outline ⚫ Combinatorics (组合) ⚫ Basic Counting Techniques ⚫ Recurrence Relations ⚫ Binomial Coefficients ⚫ Number Theory ⚫ Prime Number ⚫ Congruences ⚫ Fermat’s Theorem ⚫ Euler’s Theorem

●●● ●●●● ●●●●● ●●●● ●●0●● Part l: combinatorics ●●●● ●●●● Combinatorics is the mathematics of counting It appears to be a collection of unrelated puzzles chosen at random Given n letters and n addressed envelopes, in how many ways can the letters be placed in the envelopes so that no letter is in the correct envelope? E.g. 2: (a Google interview problem o There are n stages. Every time you can go up either 1 stage or 2 stages. How many different ways can you reach the last stage?
3 Part I: Combinatorics ⚫ Combinatorics is the mathematics of counting. ⚫ It appears to be a collection of unrelated puzzles chosen at random. ⚫ E.g. 1: ⚫ Given n letters and n addressed envelopes, in how many ways can the letters be placed in the envelopes so that no letter is in the correct envelope? ⚫ E.g. 2: (a Google interview problem) ⚫ There are n stages. Every time you can go up either 1 stage or 2 stages. How many different ways can you reach the last stage?

●●● ●●●● ●●●●● ●●●● ●●0●● Basic Counting Techniques ●●●0 ●●●● ● Product rule If there are al possibilities from set a and b possibilities from set B, then there are Ax B ways to combine one from a and one from b E.g., suppose you own 5 shirts and 4 pants, then there are 5x4 =20 different ways you can get dressed ● Sum rule If there are a possibilities from set a and b possibilities from set B, then there are A+b ways for either A or b to occur(assuming the elements of a and B are distinct)
4 Basic Counting Techniques ⚫ Product Rule ⚫ If there are |A| possibilities from set A and |B| possibilities from set B, then there are |A|x|B| ways to combine one from A and one from B. ⚫ E.g., suppose you own 5 shirts and 4 pants, then there are 5x4 =20 different ways you can get dressed. ⚫ Sum Rule ⚫ If there are |A| possibilities from set A and |B| possibilities from set B, then there are |A|+|B| ways for either A or B to occur (assuming the elements of A and B are distinct)

●●● ●●●● ●●●●● ●●●● ●●0●● Basic Counting Techniques ●●●0 ●●●● ● Inclusion-Eⅹc| usion formula ●|AUB|=|A+B|-|A∩B ●| AUBUC|=A+B|+c|-|AnB|-|Anc|-|B∩c +|AnB∩c A B A C
5 Basic Counting Techniques ⚫ Inclusion-Exclusion Formula: ⚫ |AUB| = |A| + |B| - |A∩B| ⚫ |AUBUC| = |A| + |B| + |C| - |A∩B| - |A∩C| - |B∩C| + |A∩B ∩C| A B C A B

●●● ●●●● ●●●●● ●●●● ●●0●● Basic Counting Techniques ●●●● ●●●● ● Permutations o a permutation is an arrangement of n items where every item appears exactly once o There are n! different permutations o 2-1 sn! sn-1=====> n! is a very large number 232 4,294.967296 10!=3,628800 11!=39916800 12!=479,001.600 13!=6,227,020,800>232
6 Basic Counting Techniques ⚫ Permutations ⚫ A permutation is an arrangement of n items, where every item appears exactly once. ⚫ There are n! different permutations. ⚫ 2 n-1 ≤ n! ≤ nn-1 =====> n! is a very large number. ⚫ 2 32 = 4,294,967,296 ⚫ 10! = 3,628,800 ⚫ 11! = 39,916,800 ⚫ 12! = 479,001,600 ⚫ 13! = 6,227,020,800 > 232

●●● ●●●● ●●●●● ●●●● ●●0●● Basic Counting Techniques ●●●● ●●●● ● Number of subsets o a subset is a selection of elements from n possible items. ( including the empty set) o There are 2n distinct subsets of n things o E.g., set a, b, c has 8(=23)subsets ●Φ,{a},{b},{c},{a,b},{a,c},{b,c},{a,b,c}
7 Basic Counting Techniques ⚫ Number of subsets ⚫ A subset is a selection of elements from n possible items. (including the empty set) ⚫ There are 2 n distinct subsets of n things. ⚫ E.g., set {a, b, c} has 8 (=23 ) subsets: ⚫ Ф, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b ,c}

●●● ●●●● ●●●●● ●●●● ●●0●● Recurrence Relations ●●●● ●●●● e Recurrence relation is an equation which is defined in terms of itself ●E.g.1 an an-1 +1,a1=1 E.g.2:an=2 h-1,a, 2 da=2n o E.g. 3: an=nan-1, a1=1 →an=n!
8 Recurrence Relations ⚫ Recurrence relation is an equation which is defined in terms of itself. ⚫ E.g. 1: an = an-1 + 1, a1 =1 ⚫ ➔ an = n ⚫ E.g. 2: an = 2an-1 , a1 =2 ⚫ ➔ an = 2n ⚫ E.g. 3: an = nan-1 , a1 =1 ⚫ ➔ an = n!

●●● ●●●● ●●●●● ●●●● ●●0●● Recurrence relations ●●●● ●●●● o The interview question from Google To reach the nth stage, there are two possibilities First reach the(n-2)th stage, then go to the nth stage directly First reach the(n-1)th stage, then go to the nth stage We can have the following recurrence relation ●an=an+a, n-2 a1=1,a,=2
9 Recurrence Relations ⚫ The interview question from Google ⚫ To reach the nth stage, there are two possibilities: ⚫ First reach the (n-2)th stage, then go to the nth stage directly ⚫ First reach the (n-1)th stage, then go to the nth stage ⚫ We can have the following recurrence relation: ⚫ an = an-1 + an-2 ⚫ a1 = 1, a2 = 2

●●● ●●●● ●●●●● ●●●● ●●0●● Fibonacci Numbers ●●●0 ●●●● n1+Fn2;F0=0;F1 0,1,1,2,3,5,8,13,21,34,55, …=-061803 ●C| osed form 1+√5 Fn=() 2 2)/5 It can easily proved by mathematical induction ● Golden ratio 161803 o Fibonacci numbers grow exponentially
10 ⚫ Fn = Fn-1 + Fn-2 ; F0 = 0; F1 = 1 ⚫ 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, … ⚫ Closed form: ⚫ It can easily proved by mathematical induction. ⚫ Golden ratio: ⚫ Fibonacci numbers grow exponentially. Fibonacci Numbers 1 5 1 5 (( ) ( ) ) / 5 2 2 n n F n + − = − 1 5 1.61803 2 + = = = -0.61803…
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 河南中医药大学(河南中医学院):《计算机网络》课程教学资源(PPT课件讲稿)第二章 物理层.ppt
- 《网络搜索和挖掘关键技术 Web Search and Mining》课程教学资源(PPT讲稿)Lecture 03 The term vocabulary and postings lists.ppt
- A Unified Approach to Route Planning for Shared Mobility.pptx
- 同济大学:《软件测试》课程教学资源(PPT课件讲稿)第6章 功能测试(朱少民).ppt
- 香港理工大学:Introduction to Matlab(PPT讲稿)Image Processing with MATLAB.pptx
- 同济大学:《机器学习》课程教学资源(PPT讲稿)决策树 Decision Tree.pptx
- 河南中医药大学:《网络技术实训》课程教学资源(PPT课件讲稿)网络建设中的关键技术(主讲:路景鑫).pptx
- 微信公众平台开发与应用(PPT讲座,谭海兵).pptx
- 《计算机常用工具软件》教学资源(PPT讲稿)第8章 音频工具.ppt
- 应用层网络(PPT课件讲稿)Application-layer Overlay Networks.ppt
- 中国科学技术大学:《信息论与编码技术》课程教学资源(PPT课件讲稿)第6章 有噪信道编码定理.pptx
- 《单片机原理与应用》课程教学资源(PPT课件讲稿)第2章 MCS-51单片机结构及原理.pptx
- 深圳大学:《编译原理》课程教学资源(PPT课件讲稿,共四章,尹剑飞).ppt
- 山东大学:《微机原理及单片机接口技术》课程教学资源(PPT课件讲稿)第十章 人机交互接口(主讲:刘忠国).ppt
- 谈模式识别方法在林业管理问题中的应用(PPT讲稿).pptx
- 视觉系统(PPT课件讲稿)The Visual System.ppt
- 北京大学信息学院:《高级软件工程》课程教学资源(PPT课件讲稿)第五讲 新运行平台——云计算平台.pptx
- 《数字图像处理 Digital Image Processing》课程教学资源(PPT课件讲稿)第10章数字图像处理的应用.ppt
- 南京航空航天大学:《数据结构》课程教学资源(PPT课件讲稿)第九章 查找.ppt
- 香港科技大学:Information-Agnostic Flow Scheduling for Commodity Data Centers.pptx
- 南京航空航天大学:《数据结构》课程教学资源(PPT课件讲稿)第七章 图(微软精品课程建设).ppt
- 河南中医药大学(河南中医学院):《计算机文化》课程教学资源(PPT课件讲稿)第五章 运输层.pptx
- C++ Basics(PPT讲稿).ppt
- 电子工业出版社:《计算机网络》课程教学资源(第五版,PPT课件讲稿)第五章 运输层.ppt
- 《计算机组成原理》课程电子教案(PPT课件讲稿)第4章 指令系统.ppt
- 演化计算(PPT讲稿)Evolutionary Computation(EC).ppt
- 上海交通大学:自然语言处理(PPT课件讲稿)Natural Language Processing.ppt
- 厦门大学:《大数据技术原理与应用》课程教学资源(PPT课件讲稿,2017)第4章 分布式数据库HBase.ppt
- 《软件工程》课程教学资源(PPT讲稿)软件测试——系统测试.pptx
- 香港浸会大学:《Data Communications and Networking》课程教学资源(PPT讲稿)Chapter 9 High Speed LANs and Wireless LANs.ppt
- Software Reliability & Testing(PPT讲稿)Overview of Software Reliability Engineering.ppt
- 《Java程序开发》课程教学资源(PPT课件讲稿)第11章 Struts2框架技术.ppt
- 北京航空航天大学:《数据挖掘——概念和技术(Data Mining - Concepts and Techniques)》课程教学资源(PPT课件讲稿)Chapter 02 Getting to Know Your Data.ppt
- 《计算机网络》课程教学资源(PPT课件讲稿)第三章 数据链路层.ppt
- 《信息系统与数据库技术》课程教学资源(PPT课件讲稿)第4章 T-SQL与可编程对象.ppt
- 香港理工大学:数据仓库和数据挖掘(PPT讲稿)Data Warehousing & Data Mining.ppt
- 山西农业大学:大数据技术原理与应用(PPT讲稿)Development and application of bigdata technology.ppt
- Peer-to-Peer Networks:Distributed Algorithms for P2P Distributed Hash Tables.ppt
- 中国科学技术大学:《计算机体系结构》课程教学资源(PPT课件讲稿)Chapter 01 量化设计与分析基础(主讲:周学海).ppt
- 《计算机视觉》课程教学资源(PPT课件讲稿)边缘和线特征提取.ppt