Docsity

Counting and Recurrence Relations, Summaries of Mathematics

Partial preview of the text

Download Counting and Recurrence Relations and more Summaries Mathematics in PDF only on Docsity!

Chapter 5 & 7

Counting

Objectives

Some questions we can face:

  • (^) “How can we determine the complexity of an algorithm?”
  • (^) “How can we generate input data from given initial data?”
  • (^) A password consists of six characters. How many such password with some criteria?
  • (^) How many bit strings of length n that do not have two consecutive 0s?

5.1- The Basics of Counting

 Basic Counting Principles : Product rule, sum rule, The Inclusion-Exclusion Principle  Tree Diagrams

Basic Counting Principle Ex1: How many ways are there to distribute 3 distinct balls to 2 bags? Solution: We must do ……….. times, each time we have …… ways to select a bags. There are r n ways to distribute n distinct objects to r bags

Basic Counting Principle I II III Select 1/ 12  12 ways After select 1 team for the first position, one of 11 teams can be select into the second team  11 ways After select 1 team for the second position, one of 10 remaining teams can be select into the third team  10 ways Ex3: 12 teams. How many ways to select 3 teams for the first, second and third teams. Answer:

Ex4: Choose a 6 – character password: ****** (Note:

  • can be 0,…,9, a,…,z, A,…Z) How many possible passwords? Answer:

Ex6: How many functions are there from {a, b} to {2, 3, 5}? Answer: Ex7: How many one-to-one functions are there from a set with m elements to one with n elements? Answer:

Ex8: a. How many positive divisors does 120 have? Answer: b. In how many ways can a teacher seat 4 girls and 3 boys in a row seats if a boy must be seated in the first and a girl in the last seat? Answer:

Ex10: There are 37 faculties, 83 students. A person either a faculty or student can be choose to attend a committee. How many ways are there to select such person? Answer:

Ex11: A student can choose a project from one of three field: Information system: 32 projects Software Engineering: 12 projects Computer Science: 15 projects. How many ways are there for a student to choose? Answer:

Basic Counting Principles… Ex12: Name of a variable in BASIC language, a case insensitive language, is a string of 1 or 2 characters in which the first must be a letter, the second may be an alphanumeric characters, and must be different from 5 two-character keywords. How many different variable names are there?

Basic Counting Principles… Ex13: Each user on a computer system has a password, which has properties:

  • Six to eight characters long
  • Character is a letter or a digit
  • Contain at least one digit. How many possible passwords are there?

Basic Counting Principles: The Inclusion-Exclusion Principle Ex14: How many 7-bit strings either start with 1 or end with 00?

Basic Counting Principles: The Inclusion-Exclusion Principle Ex15: 350 applications, in which A1: 220 people majored in IT A2: 147 people majored in business A3: 51 people majored both in IT and business How many applicants majored neither in IT nor business?