Lesson 18: Counting - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Lesson 18: Counting

Description:

Count the number of possible IPv4 internet addresses ... If there are n ways to make choice 1 and m ways to make choice 2, then the total ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 15
Provided by: jwi6
Category:

less

Transcript and Presenter's Notes

Title: Lesson 18: Counting


1
Lesson 18 Counting
  • Objectives
  • Use the product rule and sum rule to count
    objects
  • Count 1-to-1 functions
  • Count the number of possible IPv4 internet
    addresses
  • Use the principle of inclusion-exclusion for
    counting
  • Use tree diagrams for counting
  • Outline
  • Recursive algorithms
  • Iterative algorithms
  • Reading 4.1
  • Due Weds 4/5
  • 3.4 4,8, 11, 18, 26a, 28a, 34, 35

2
Counting (chapter 4)
  • Importance of counting
  • Allocation of Resources
  • Probability
  • Security
  • Collisions

3
Counting
  • Product Rule
  • If there are n ways to make choice 1 and m ways
    to make choice 2, then the total number of
    choices is
  • mn

4
Computer passwords
  • If lowercase alphabetic characters are allowed,
    how many 8-character passwords are there?
  • If upper- and lower-case and numeric characters
    are allowed, how many 10-character passwords are
    there?

5
MAC Addresses
  • Ethernet addresses consist of a 48-bit MAC
    address hard-coded into each network card. How
    many possible unique cards can be produced with
    this system?
  • If the first 24 bits uniquely identifies the
    vendor of the card (which it does), how many
    cards can be associated with each vendors ID?
  • How should 3Com respond to this?

6
License Plates
  • Assume each state follows this format for their
    license plates
  • AIB 346
  • how many license plates could be generated
    throughout the US?

7
Sum Rule
  • If a first task can be done n ways and a second
    task m ways, but the tasks cannot be done at the
    same time, there are nm choices.

8
Sum Rule
  • A character used in a certain font can either be
    an upper-case Latin character, lower-case English
    character, upper-case Greek character, or a
    Hiragana character.
  • How many possible characters are there?

9
IPv4
  • How many internet addresses are possible?
  • Class A 0, 7-bit netid, 24-bit hostid
  • Class B 10, 14-bit netid, 16-bit hostid
  • Class C 110, 21-bit netid, 8-bit hostid
  • (Class D, E, unassigned)
  • Class A Cannot have 1111111 as netid
  • all 1s or 0s not allowed for any hostid

10
Inclusion-Exclusion
  • When tasks are not mutually exclusive, we need to
    subtract the overcount
  • A1 ? A2 A1 A2 - A1 ? A2

11
Inclusion-Exclusion
  • How many 8-bit binary strings either start with 1
    or end in 110?

12
Inclusion-Exclusion
  • How many numbers 1 to 400 are divisible by 6 or 8?

13
Trees
  • How many possible outcomes are there for the NCAA
    tournament?

14
Trees for counting
  • Pants come in corduroy, denim, and polyester.
    Sizes available are 30, 32, 34, 36, and 38.
    However, the polyester is available in 40 and 48
    to accommodate big tall men. Colors available
    are brown and black for corduroy, black, blue,
    and white for denim, and chartreuse, turquoise,
    and magenta for polyester. The big tall sizes
    also are available in black.
  • How many kinds of pants are there?
Write a Comment
User Comments (0)
About PowerShow.com