Let A be the set {1,3,5,7,9}. How many sequences on A sum to 6?
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Let A be the set {1,3,5,7,9}. How many sequences on A sum to 6?

Transcribed Image Text:2.3.7 Counting Algorithmically (Without a Formula)
In this subsection, we want to provide a strategy for counting sequences, using tree
diagrams, which can be applied when the set of possible values for s; depends on
what the previous values in S actually are. We'll look at two examples.
Example 2.3.6: Sequences on P that sum to 5
How many sequences of positive integers have a sum that equals 5?
// Both (1,4) and (1,1,2,1) sum to 5, so we'll have to deal with sequences of
// varying lengths. But, since each entry is at least one, there can be at most 5
// entries.
Let's generate all such sequences, one entry at a time, by growing a "tree of
possibilities." Suppose S= (s1, S2,. .., Sk) is such a sequence. The possible values for
S1 are 1,2,3,4, and 5. This may be displayed by
start
3
4
5
The vertex labeled start, at the top of the diagram, is called the "root" of the tree.
Attached to the root are five “branches," one for each possible value of s1. These
possible values of s1 are written inside the vertices (circles) at the ends of the 5
branches.
// Yes, the tree is upside down.
If s1 = 1, then the possible values for s2 are 1,2,3, and 4, and we may add 4 more
(downward) branches from the vertex corresponding to s1 = 1. If s1 = 2, then the
possible values for s2 are 1,2, and 3, and we may add 3 more branches from the
vertex corresponding to s1 = 2. But if s1 = 5, then the current subsequence cannot
be extended; we cannot add more branches from the vertex corresponding to s1 = 5.
These terminal vertices are called "leaves" and are indicated in the diagram as
squares (rather than circles).
From each vertex indicating a possible value of s2 that's not a leaf, we may add
branches corresponding to values of s3. And so on until we have a diagram of all
sequences on P that sum to 5.

Transcribed Image Text:start
5
4
2
1
Now, by counting the leaves, we have determined that there are exactly 16
sequences on P which sum to 5.
We have consistently labeled the values below a vertex from smallest to largest
across the diagram from left to right. If we take the leaves as they occur across the
diagram from left to right, and write down the corresponding sequence, we get
1. (1,1,1,1,1)
2. (1,1,1,2)
// aaaaa
// aaab
// aaba
3. (1,1,2,1)
4. (1,1,3)
// aac
5. (1,2,1,1)
// abaa
6. (1,2,2)
// abb
7. (1,3,1)
// aca
8. (1,4)
// ad
// baaa
// bab
9. (2,1,1,1)
10. (2,1,2)
11. (2,2,1)
// bba
12. (2,3)
// bc
13. (3,1,1)
// caa
14. (3,2)
// cb
15. (4,1)
// da
16. (5)
// e
// There is something special about the order in which the sequences appear.
// If the first 5 digits were replaced by the first 5 letters, the sequences of digits
// produce "words" in alphabetic or lexicographic order.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY