You will write a program that inputs the number of buttons nuttons and a word sequence i (given as a vector of length nword Consisting of integers in [0, nbuttons – 1]) and uses Markov chains to output the expected amount of time until the word sequence w appears. Before you write the program, do the following: • a) A naive way to model this as a Markov chain would be to use the sequence of the last nword letters that appear in the monkey's text (e.g. the state space is the set of ALL possible nword letter words). Explain why using this as the Markov chain would be difficult for the computer to handle. • b) Instead of the naive way above, come up with a Markov chain for the problem which the size of the state space does not depend on nbuttons that can be used to solve this problem. Be sure to clearly indicate the states of the Markov chain! • c) Analyze the simple case of nguttons = 6 by hand (This corresponds to the situation where the monkey's typing is the same as rolls of fair 6 sided dice) Draw out the directed graph of the Markov chain corresponding to the word sequence "0, 0" Draw out the directed graph of the Markov chain corresponding the word sequence "0, 1" Using the graphs, do you think the expected amount of time for the monkey to type these two word sequences is same? Give an intuitive explanation why or why not.

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...
icon
Related questions
Question

please do 3b (python). information and question are shown. 

You will write a program that inputs the number of buttons nhuttons and a word sequence u (given as a vector
of length nword Consisting of integers in [0, nbuttons – 1]) and uses Markov chains to output the expected amount
of time until the word sequence u appears. Before you write the program, do the following:
• a) A naive way to model this as a Markov chain would be to use the sequence of the last nword letters that
appear in the monkey's text (e.g. the state space is the set of ALL possible nword letter words). Explain why
using this as the Markov chain would be difficult for the computer to handle.
• b) Instead of the naive way above, come up with a Markov chain for the problem which the size of the state
space does not depend on nbuttons that can be used to solve this problem. Be sure to clearly indicate the
states of the Markov chain!
c) Analyze the simple case of nguttons = 6 by hand (This corresponds to the situation where the monkey's
typing is the same as rolls of fair 6 sided dice)
Draw out the directed graph of the Markov chain corresponding to the word sequence "0, 0"
Draw out the directed graph of the Markov chain corresponding the word sequence "0, 1"
Using the graphs, do you think the expected amount of time for the monkey to type these two word
sequences is same? Give an intuitive explanation why or why not.
Transcribed Image Text:You will write a program that inputs the number of buttons nhuttons and a word sequence u (given as a vector of length nword Consisting of integers in [0, nbuttons – 1]) and uses Markov chains to output the expected amount of time until the word sequence u appears. Before you write the program, do the following: • a) A naive way to model this as a Markov chain would be to use the sequence of the last nword letters that appear in the monkey's text (e.g. the state space is the set of ALL possible nword letter words). Explain why using this as the Markov chain would be difficult for the computer to handle. • b) Instead of the naive way above, come up with a Markov chain for the problem which the size of the state space does not depend on nbuttons that can be used to solve this problem. Be sure to clearly indicate the states of the Markov chain! c) Analyze the simple case of nguttons = 6 by hand (This corresponds to the situation where the monkey's typing is the same as rolls of fair 6 sided dice) Draw out the directed graph of the Markov chain corresponding to the word sequence "0, 0" Draw out the directed graph of the Markov chain corresponding the word sequence "0, 1" Using the graphs, do you think the expected amount of time for the monkey to type these two word sequences is same? Give an intuitive explanation why or why not.
0.3 Problem 3 - Monkey at a typewriter (also known as the “ABRACADABRA"
problem)
A monkey is typing on a typewriter and generates a long string of random letters. For example, the first 14
characters might look like the monkey might type the string:
Position | 1 | 2 | 3 | 4 | 5 | 6 | 7 8 |9 10 | 11 | 12 | 13 | 14 || 14
Letter | B| C | D | B | A | B | R | A | C | A | D | A | B | R | A
We are interested in investigating how long it takes for interesting words to appear in the monkey's text. For
example, in the above example, the words “ABRACADABRA" fully appears in the text after 14 letters have been
typed.
We model this situation as follows:
1
Assume there are nbuttons possible buttons on the typewritter the monkey can press which are ordered
bo, b1,... bn-1. Any word can be represented by a finite sequence of integers. For example, if bo ="A", bị =
"B", b2 = "C" ,b3 ="D",...bıs = "R" then the word "ABRACADABRA" is the sequence 0, 1, 18, 1, 2,0, 3, 0, 1, 18, 0.
On a computer we represent this as a vector of length nword. Each element of the vector is an integer in
[0, word – 1])
Assume all buttons are equally likely.
• Assume the button pressed is independently at random, independent of all the other button presses that have
ever been pressed.
Transcribed Image Text:0.3 Problem 3 - Monkey at a typewriter (also known as the “ABRACADABRA" problem) A monkey is typing on a typewriter and generates a long string of random letters. For example, the first 14 characters might look like the monkey might type the string: Position | 1 | 2 | 3 | 4 | 5 | 6 | 7 8 |9 10 | 11 | 12 | 13 | 14 || 14 Letter | B| C | D | B | A | B | R | A | C | A | D | A | B | R | A We are interested in investigating how long it takes for interesting words to appear in the monkey's text. For example, in the above example, the words “ABRACADABRA" fully appears in the text after 14 letters have been typed. We model this situation as follows: 1 Assume there are nbuttons possible buttons on the typewritter the monkey can press which are ordered bo, b1,... bn-1. Any word can be represented by a finite sequence of integers. For example, if bo ="A", bị = "B", b2 = "C" ,b3 ="D",...bıs = "R" then the word "ABRACADABRA" is the sequence 0, 1, 18, 1, 2,0, 3, 0, 1, 18, 0. On a computer we represent this as a vector of length nword. Each element of the vector is an integer in [0, word – 1]) Assume all buttons are equally likely. • Assume the button pressed is independently at random, independent of all the other button presses that have ever been pressed.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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 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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY