Pseudo code in picture 2(write like this)

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
Pseudo code in picture 2(write like this)
Algorithm Ex1 ((a₁, ... an), (b₁, ..., bm))
k
for i
0
1 to n do
j+1
while j < m do
If a₁ = = b;
j+j+1
return k > 0
k+ k + 1
Transcribed Image Text:Algorithm Ex1 ((a₁, ... an), (b₁, ..., bm)) k for i 0 1 to n do j+1 while j < m do If a₁ = = b; j+j+1 return k > 0 k+ k + 1
(d)
A data pattern analyser is to be built that can detect and count up the number
of occurrences of two and three letter same letter sequences in a sequence
(e.g. (a,a) or (b,b,b)). The analyser should stop if it encounters * in the
sequence and return the number of occurrences found up to that point in the
form of a 2-tuple (#2LetterSequences, #3LetterSequences). A 3 letter
sequence should only count as a 3 letter sequence, not an occurrence of two
2 letter sequences. No letter in the input sequence ever occurs more than 3
times in a row.
So, for example:
Input string
(a,b,a,b,b,a,a,*)
(x,x,x,y,y)
(p,q,p,z,z,*)
(*,a,a)
(x,x,a,d,*, s,s,s,l)
2 letter sequences
found
2
1
1
0
1
3
3 letter sequences
found
0
1
0
0
0
Produce a formal statement of this problem, and then write an algorithm to
solve the problem using a pseudo code style similar to the one shown in parts
(a) to (c). State the bounds on the best and worst case performance of your
algorithms using O, 2 and 0 appropriately
Transcribed Image Text:(d) A data pattern analyser is to be built that can detect and count up the number of occurrences of two and three letter same letter sequences in a sequence (e.g. (a,a) or (b,b,b)). The analyser should stop if it encounters * in the sequence and return the number of occurrences found up to that point in the form of a 2-tuple (#2LetterSequences, #3LetterSequences). A 3 letter sequence should only count as a 3 letter sequence, not an occurrence of two 2 letter sequences. No letter in the input sequence ever occurs more than 3 times in a row. So, for example: Input string (a,b,a,b,b,a,a,*) (x,x,x,y,y) (p,q,p,z,z,*) (*,a,a) (x,x,a,d,*, s,s,s,l) 2 letter sequences found 2 1 1 0 1 3 3 letter sequences found 0 1 0 0 0 Produce a formal statement of this problem, and then write an algorithm to solve the problem using a pseudo code style similar to the one shown in parts (a) to (c). State the bounds on the best and worst case performance of your algorithms using O, 2 and 0 appropriately
Expert Solution
steps

Step by step

Solved in 2 steps

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