SlideShare a Scribd company logo
1 of 16
Proficient Computer Network
Assignment Help
For any help regarding Computer Network Assignment Help
Visit :- https://computernetworkassignmenthelp.com/ ,
Email :- support@computernetworkassignmenthelp.com or
Call us at :- +1 678 648 4277
Problem 1.
Suppose you are given a source string S[0 . . n − 1] of length n, consisting of symbols a and b.
Suppose further that you are given a pattern string P[0 . . m − 1] of length m « n, consisting of
symbols a, b, and ∗, representing a pattern to be found in string S. The symbol ∗ is a “wild
card” symbol, which matches a single symbol, either a or b. The other symbols must match
exactly.
The problem is to output a sorted list M of valid “match positions”, which are positions j in
S such that pattern P matches the substring S[j . . j + |P| − 1]. For example, if S = a b a b b a
b and P = a b ∗, then the output M should be [0, 2].
(a) Describe a straightforward, na¨ıve algorithm to solve the problem. Your algorithm should
run in time O(nm).
(b) Give an algorithm to solve the problem by reducing it to the problem of polynomial
multiplication. Specifically, describe how to convert strings S and P into polynomials such
that the product of the polynomials allows you to determine the answer M. Give examples
to illustrate your polynomial representation of the inputs and your way of determining
outputs from the product, based on the example S and P strings given above.
computernetworkassignmenthelp.com
(c) Suppose you combine your solution to Part (b) with an FFT algorithm for polynomial
multiplication, as presented in Lecture 3. What is the time complexity of the resulting solution
to the string matching problem?
(d) Now consider the same problem but with a larger symbol alphabet. Specifically, suppose
you are given a representation of a DNA strand as a string D[0 . . n−1] of length n, consisting of
symbols A, C, G, and T; and you are given a pattern string P[0 . . m − 1] of length m « n,
consisting of symbols A, C, G, T, and ∗. The problem is, again, to output a sorted list M of valid
“match positions”, which are positions j in D such that pattern P matches the substring D[j . . j +
|P| − 1]. For example, if D = A C G A C C A T and P = A C ∗ A, then the output M should be [0,
3].
Based on your solutions to Parts (b) and (c), give an efficient algorithm for this setting. Illustrate
your algorithm on the example above.
Problem 2. Combining B-trees
Consider a new B-tree operation COMBINE(T1, T2, k). This operation takes as input two B-
trees T1 and T2 with the same minimum degree parameter t, plus a new key k that does not
appear in either T1 or T2. We assume that all the keys in T1 are strictly smaller than k and all
the keys in T2 are strictly larger than k. The COMBINE operation produces a new B-tree T,
with the same minimum degree t, whose keys are those in T1, those in T2, plus k. In the
process, it destroys the original trees T1 and T2.
computernetworkassignmenthelp.com
In this problem, you will design an algorithm to implement the COMBINE operation. Your
algorithm should run in time O(|h1 − h2| + 1), where h1 and h2 are the heights of trees T1 and
T2 respectively. In analyzing the costs, you should regard t as a constant.
(a) First consider the special case of the problem in which h1 is assumed to be equal to h2.
Give an algorithm to combine the trees that runs in constant time.
(b) Consider another special case, in which h1 is assumed to be exactly equal to h2 + 1.
Give a constant-time algorithm to combine the trees.
(c) Now consider the more general case in which h1 and h2 are arbitrary. Because the
algorithm must work in such a small amount of time, and must work for arbitrary
heights, a first step is to develop a new kind of augmented B-tree data
structure in which each node x always carries information about the height of the subtree
below x. Describe how to augment the common B-tree insertion and deletion operations to
maintain this information, while still maintaining the asymptotic time complexity of all
operations.
(d) Now give an algorithm for combining two B-trees T1 and T2, in the general case where
h1 and h2 are arbitrary. Your algorithm should run in time O(|h1−h2|+1).
computernetworkassignmenthelp.com
Problem 1. Pattern Matching
Suppose you are given a source string S[0 . . n − 1] of length n, consisting of symbols a and
b. Suppose further that you are given a pattern string P[0 . . m − 1] of length m « n,
consisting of symbols a, b, and ∗, representing a pattern to be found in string S. The symbol ∗
is a “wild card” symbol, which matches a single symbol, either a or b. The other symbols
must match exactly.
The problem is to output a sorted list M of valid “match positions”, which are positions j
in S such that pattern P matches the substring S[j . . j + |P| − 1]. For example, if S = a b a b
b a b and P = a b ∗, then the output M should be [0, 2].
(a) Describe a straightforward, na¨ıve algorithm to solve the problem. Your algorithm
should run in time O(nm).
Solution: One can explicitly check every possible starting position s ∈ {0, 1, . . . , n− m}
by checking whether each entry in P matches from s to s + m − 1.
computernetworkassignmenthelp.com
NAIVE-ALGORITHM(S, P)
(b) Give an algorithm to solve the problem by reducing it to the problem of polynomial
multiplication. Specifically, describe how to convert strings S and P into polynomials such that
the product of the polynomials allows you to determine the answer M. Give examples to
illustrate your polynomial representation of the inputs and your way of determining outputs
from the product, based on the example S and P strings given above.
Solution: Let’s represent a by 1, b by −1, and ∗ by 0. We will use these representations
instead of the original symbols in this solution. Notice that P matches S starting from
position j, 0 ≤ j ≤ n − m, if and only if for every i, 0 ≤ i ≤ m − 1, either P[i] = 0 or S[j + i]P[i]
= 1. This is true if and only if
computernetworkassignmenthelp.com
where k is the number of non-∗ symbols in P.
We would like to express these summations as coefficients of a product of polynomials. Let x
be a variable. Represent S as
where each Q[i] = P[m − 1 − i]. Thus, we have reversed the order of the coefficients in this last
representation.
Suppose C is the product of the S polynomial and the P polynomial. Then the coefficient of
xm−1+j in C is
computernetworkassignmenthelp.com
This is the same as the sum above. To obtain the output M, we simply examine all the coefficients
of C, outputting position number j, 0 ≤ j ≤ n − m, exactly if the coefficient of xm−1+j is equal to k,
the total number of non-∗ symbols in P. We output these in order of increasing j, as required. In the
example above, S is represented by
computernetworkassignmenthelp.com
The number k is equal to 2, so the terms of interest are 2x2, 2x4, and 2x7. These would yield
j = 0, 2, 5, but 5 is ruled out because we are only considering j ≤ n − m = 7 − 3 = 4.
(c) Suppose you combine your solution to Part (b) with an FFT algorithm for polynomial
multiplication, as presented in Lecture 3. What is the time complexity of the resulting solution
to the string matching problem?
Solution: It’s O(n lg n). It takes time O(n lg n) to perform the needed DFT and inverse DFT
algorithms, and O(n) for producing inputs for the DFT algorithm and extracting M from the
outputs.
d) Now consider the same problem but with a larger symbol alphabet. Specifically, suppose
you are given a representation of a DNA strand as a string D[0 . . n−1] of length n, consisting
of symbols A, C, G, and T; and you are given a pattern string P[0 . . m − 1] of length m « n,
consisting of symbols A, C, G, T, and ∗.
The problem is, again, to output a sorted list M of valid “match positions”, which are positions
j in D such that pattern P matches the substring D[j . . j + |P| − 1]. For example, if D = A C G
A C C A T and P = A C ∗ A, then the output M should be [0, 3].
Based on your solutions to Parts (b) and (c), give an efficient algorithm for this setting.
Illustrate your algorithm on the example above.
computernetworkassignmenthelp.com
Solution: Use a reduction. Encode A as a a, C as a b, G as b a, T as b b, and ∗ as ∗ ∗. Use our
previous solution to solve the problem on the resulting string, obtaining a list M' of positions.
The final output list M will consist of just the even numbers from the list M' , all divided by
2.
This will take the time it takes to convert and then solve the original problem on arrays of
length 2n and 2m respectively:
Consider a new B-tree operation COMBINE(T1, T2, k). This operation takes as input two B-
trees T1 and T2 with the same minimum degree parameter t, plus a new key k that does not
appear in either T1 or T2. We assume that all the keys in T1 are strictly smaller than k and all
the keys in T2 are strictly larger than k. The COMBINE operation produces a new B-tree T,
with the same minimum degree t, whose keys are those in T1, those in T2, plus k. In the
process, it destroys the original trees T1 and T2.
computernetworkassignmenthelp.com
In this problem, you will design an algorithm to implement the COMBINE operation. Your
algorithm should run in time O(|h1 − h2| + 1), where h1 and h2 are the heights of trees T1
and T2 respectively. In analyzing the costs, you should regard t as a constant.
(a) First consider the special case of the problem in which h1 is assumed to be equal to h2.
Give an algorithm to combine the trees that runs in constant time.
Solution: Construct a new root node for T consisting of the root nodes for T1 and T2, with
the root of T1 at the left, and with k inserted between the keys of the two original roots.
Then, if the number of keys in the resulting root node is at least 2t−1 then split the root
node around its median, forming a new root node containing one key and two child nodes
containing at least t − 1 keys apiece.
COMBINE(T1, T2, k)
computernetworkassignmenthelp.com
computernetworkassignmenthelp.com
(b) Consider another special case, in which h1 is assumed to be exactly equal to h2 +
1. Give a constant-time algorithm to combine the trees.
Solution: Append k to the right end of the right child node of T1 and append the root
of T2 to that. Clearly this preserves sorted order. Now the right child may have
anywhere from t + 1 to 4t − 1 keys. If it has 2t − 1 or more keys, then split it around its
median key. If that causes the root node to have 2t − 1 nodes then split that around its
median key, thus adding another level to the tree.
COMBINE(T1, T2, k)
computernetworkassignmenthelp.com
(c) Now consider the more general case in which h1 and h2 are arbitrary. Because the algorithm
must work in such a small amount of time, and must work for arbitrary heights, a first step is to
develop a new kind of augmented B-tree data structure in which each node x always carries
information about the height of the subtree below x. Describe how to augment the common B-
tree insertion and deletion operations to maintain this information, while still maintaining the
asymptotic time complexity of all operations.
Solution: Augment the tree by adding a height attribute for each node. The height of a leaf node
is 0. For internal nodes, HEIGHT(x) = HEIGHT(x.c1) + 1.
Insertion: New nodes are added during splitting. The newly allocated node in a split has the
same height as the original node. The only other time a node is added is when the root is split.
This is done by making the root the child of a dummy node and then splitting it. The height of
the new root is set to one greater than the height of the old root.
Deletion: In deletion, no nodes are deleted except the root. Since height values are indexed
starting at the leaf, deletion does not affect node heights.
With these additions, the asymptotic running time for insertion and deletion is that same as
before, O(lg n).
computernetworkassignmenthelp.com
(d) Now give an algorithm for combining two B-trees T1 and T2, in the general case where
h1 and h2 are arbitrary. Your algorithm should run in time O(|h1−h2|+1).
Solution:
If |h1 − h2| < 2, use part (a) or (b). Otherwise, assume that h1 > h2 + 1 (h2 > h1 + 1 works
symmetrically). Let x be the rightmost node of T1 at level h2. Add k at the right end of x
and append the root of T2 to that. Now node x may have anywhere from t + 1 to 4t − 1
keys. If it has 2t − 1 or more keys, then split it around its median key. The split may
propagate upwards, possibly as far as the root. So, the time complexity depends linearly on
the height difference O(|h1 − h2|).
COMBINE(T1, T2, k)
computernetworkassignmenthelp.com
computernetworkassignmenthelp.com

More Related Content

Similar to Proficient Computer Network Assignment Help

Differential Equations Assignment Help
Differential Equations Assignment HelpDifferential Equations Assignment Help
Differential Equations Assignment HelpMaths Assignment Help
 
Differential Equations Homework Help
Differential Equations Homework HelpDifferential Equations Homework Help
Differential Equations Homework HelpMath Homework Solver
 
Sienna 10 dynamic
Sienna 10 dynamicSienna 10 dynamic
Sienna 10 dynamicchidabdu
 
5.3 dynamic programming 03
5.3 dynamic programming 035.3 dynamic programming 03
5.3 dynamic programming 03Krish_ver2
 
Design and Analysis of Algorithms Exam Help
Design and Analysis of Algorithms Exam HelpDesign and Analysis of Algorithms Exam Help
Design and Analysis of Algorithms Exam HelpProgramming Exam Help
 
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxSAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxanhlodge
 
CS229 Machine Learning Lecture Notes
CS229 Machine Learning Lecture NotesCS229 Machine Learning Lecture Notes
CS229 Machine Learning Lecture NotesEric Conner
 
A MATLAB project on LCR circuits
A MATLAB project on LCR circuitsA MATLAB project on LCR circuits
A MATLAB project on LCR circuitssvrohith 9
 
50 SDE Interview Questions.pdf
50 SDE Interview Questions.pdf50 SDE Interview Questions.pdf
50 SDE Interview Questions.pdfHeyCoach
 
Digital Communication Assignment Help
Digital Communication Assignment HelpDigital Communication Assignment Help
Digital Communication Assignment HelpEdu Assignment Help
 
On problem-of-parameters-identification-of-dynamic-object
On problem-of-parameters-identification-of-dynamic-objectOn problem-of-parameters-identification-of-dynamic-object
On problem-of-parameters-identification-of-dynamic-objectCemal Ardil
 

Similar to Proficient Computer Network Assignment Help (20)

Calculus Homework Help
Calculus Homework HelpCalculus Homework Help
Calculus Homework Help
 
Calculus Assignment Help
Calculus Assignment HelpCalculus Assignment Help
Calculus Assignment Help
 
Differential Equations Assignment Help
Differential Equations Assignment HelpDifferential Equations Assignment Help
Differential Equations Assignment Help
 
Daa chapter11
Daa chapter11Daa chapter11
Daa chapter11
 
Calculus Assignment Help
 Calculus Assignment Help Calculus Assignment Help
Calculus Assignment Help
 
Signals and Systems Homework Help.pptx
Signals and Systems Homework Help.pptxSignals and Systems Homework Help.pptx
Signals and Systems Homework Help.pptx
 
Differential Equations Homework Help
Differential Equations Homework HelpDifferential Equations Homework Help
Differential Equations Homework Help
 
Sienna 10 dynamic
Sienna 10 dynamicSienna 10 dynamic
Sienna 10 dynamic
 
5.3 dynamic programming 03
5.3 dynamic programming 035.3 dynamic programming 03
5.3 dynamic programming 03
 
Design and Analysis of Algorithms Exam Help
Design and Analysis of Algorithms Exam HelpDesign and Analysis of Algorithms Exam Help
Design and Analysis of Algorithms Exam Help
 
Design & Analysis of Algorithms Assignment Help
Design & Analysis of Algorithms Assignment HelpDesign & Analysis of Algorithms Assignment Help
Design & Analysis of Algorithms Assignment Help
 
Computer Network Homework Help
Computer Network Homework HelpComputer Network Homework Help
Computer Network Homework Help
 
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxSAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
 
CS229 Machine Learning Lecture Notes
CS229 Machine Learning Lecture NotesCS229 Machine Learning Lecture Notes
CS229 Machine Learning Lecture Notes
 
A MATLAB project on LCR circuits
A MATLAB project on LCR circuitsA MATLAB project on LCR circuits
A MATLAB project on LCR circuits
 
Exhaustive Combinatorial Enumeration
Exhaustive Combinatorial EnumerationExhaustive Combinatorial Enumeration
Exhaustive Combinatorial Enumeration
 
50 SDE Interview Questions.pdf
50 SDE Interview Questions.pdf50 SDE Interview Questions.pdf
50 SDE Interview Questions.pdf
 
Lecture26
Lecture26Lecture26
Lecture26
 
Digital Communication Assignment Help
Digital Communication Assignment HelpDigital Communication Assignment Help
Digital Communication Assignment Help
 
On problem-of-parameters-identification-of-dynamic-object
On problem-of-parameters-identification-of-dynamic-objectOn problem-of-parameters-identification-of-dynamic-object
On problem-of-parameters-identification-of-dynamic-object
 

More from Computer Network Assignment Help

Elevate Your Networking Game with Expert Computer Network Assignment Help
Elevate Your Networking Game with Expert Computer Network Assignment HelpElevate Your Networking Game with Expert Computer Network Assignment Help
Elevate Your Networking Game with Expert Computer Network Assignment HelpComputer Network Assignment Help
 

More from Computer Network Assignment Help (19)

Elevate Your Networking Game with Expert Computer Network Assignment Help
Elevate Your Networking Game with Expert Computer Network Assignment HelpElevate Your Networking Game with Expert Computer Network Assignment Help
Elevate Your Networking Game with Expert Computer Network Assignment Help
 
Get 15% off on Computer Network Assignment Help
Get 15% off on Computer Network Assignment HelpGet 15% off on Computer Network Assignment Help
Get 15% off on Computer Network Assignment Help
 
Computer Network Assignment Help
Computer Network Assignment HelpComputer Network Assignment Help
Computer Network Assignment Help
 
Advanced Computer Network Assignment Help
Advanced Computer Network Assignment HelpAdvanced Computer Network Assignment Help
Advanced Computer Network Assignment Help
 
Computer Network Assignment Help.pptx
Computer Network Assignment Help.pptxComputer Network Assignment Help.pptx
Computer Network Assignment Help.pptx
 
Computer Network Homework Help
Computer Network Homework HelpComputer Network Homework Help
Computer Network Homework Help
 
Online Computer Network Security Assignment Help
Online Computer Network Security Assignment HelpOnline Computer Network Security Assignment Help
Online Computer Network Security Assignment Help
 
Computer Network Homework Help
Computer Network Homework HelpComputer Network Homework Help
Computer Network Homework Help
 
Computer Network Assignment Help
Computer Network Assignment HelpComputer Network Assignment Help
Computer Network Assignment Help
 
Computer Network Assignment Help
Computer Network Assignment HelpComputer Network Assignment Help
Computer Network Assignment Help
 
Networking Assignment Help
Networking Assignment HelpNetworking Assignment Help
Networking Assignment Help
 
Computer Network Assignment Help
Computer Network Assignment HelpComputer Network Assignment Help
Computer Network Assignment Help
 
Computer Network Assignment Help
Computer Network Assignment HelpComputer Network Assignment Help
Computer Network Assignment Help
 
Computer Network Assignment Help
Computer Network Assignment HelpComputer Network Assignment Help
Computer Network Assignment Help
 
Network Design Assignment Help
Network Design Assignment HelpNetwork Design Assignment Help
Network Design Assignment Help
 
Computer Networking Assignment Help
Computer Networking Assignment HelpComputer Networking Assignment Help
Computer Networking Assignment Help
 
Computer Network Assignment Help
Computer Network Assignment HelpComputer Network Assignment Help
Computer Network Assignment Help
 
Computer Network Assignment Help
Computer Network Assignment HelpComputer Network Assignment Help
Computer Network Assignment Help
 
Computer Networking Assignment Help
Computer Networking Assignment HelpComputer Networking Assignment Help
Computer Networking Assignment Help
 

Recently uploaded

Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 

Recently uploaded (20)

Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 

Proficient Computer Network Assignment Help

  • 1. Proficient Computer Network Assignment Help For any help regarding Computer Network Assignment Help Visit :- https://computernetworkassignmenthelp.com/ , Email :- support@computernetworkassignmenthelp.com or Call us at :- +1 678 648 4277
  • 2. Problem 1. Suppose you are given a source string S[0 . . n − 1] of length n, consisting of symbols a and b. Suppose further that you are given a pattern string P[0 . . m − 1] of length m « n, consisting of symbols a, b, and ∗, representing a pattern to be found in string S. The symbol ∗ is a “wild card” symbol, which matches a single symbol, either a or b. The other symbols must match exactly. The problem is to output a sorted list M of valid “match positions”, which are positions j in S such that pattern P matches the substring S[j . . j + |P| − 1]. For example, if S = a b a b b a b and P = a b ∗, then the output M should be [0, 2]. (a) Describe a straightforward, na¨ıve algorithm to solve the problem. Your algorithm should run in time O(nm). (b) Give an algorithm to solve the problem by reducing it to the problem of polynomial multiplication. Specifically, describe how to convert strings S and P into polynomials such that the product of the polynomials allows you to determine the answer M. Give examples to illustrate your polynomial representation of the inputs and your way of determining outputs from the product, based on the example S and P strings given above. computernetworkassignmenthelp.com
  • 3. (c) Suppose you combine your solution to Part (b) with an FFT algorithm for polynomial multiplication, as presented in Lecture 3. What is the time complexity of the resulting solution to the string matching problem? (d) Now consider the same problem but with a larger symbol alphabet. Specifically, suppose you are given a representation of a DNA strand as a string D[0 . . n−1] of length n, consisting of symbols A, C, G, and T; and you are given a pattern string P[0 . . m − 1] of length m « n, consisting of symbols A, C, G, T, and ∗. The problem is, again, to output a sorted list M of valid “match positions”, which are positions j in D such that pattern P matches the substring D[j . . j + |P| − 1]. For example, if D = A C G A C C A T and P = A C ∗ A, then the output M should be [0, 3]. Based on your solutions to Parts (b) and (c), give an efficient algorithm for this setting. Illustrate your algorithm on the example above. Problem 2. Combining B-trees Consider a new B-tree operation COMBINE(T1, T2, k). This operation takes as input two B- trees T1 and T2 with the same minimum degree parameter t, plus a new key k that does not appear in either T1 or T2. We assume that all the keys in T1 are strictly smaller than k and all the keys in T2 are strictly larger than k. The COMBINE operation produces a new B-tree T, with the same minimum degree t, whose keys are those in T1, those in T2, plus k. In the process, it destroys the original trees T1 and T2. computernetworkassignmenthelp.com
  • 4. In this problem, you will design an algorithm to implement the COMBINE operation. Your algorithm should run in time O(|h1 − h2| + 1), where h1 and h2 are the heights of trees T1 and T2 respectively. In analyzing the costs, you should regard t as a constant. (a) First consider the special case of the problem in which h1 is assumed to be equal to h2. Give an algorithm to combine the trees that runs in constant time. (b) Consider another special case, in which h1 is assumed to be exactly equal to h2 + 1. Give a constant-time algorithm to combine the trees. (c) Now consider the more general case in which h1 and h2 are arbitrary. Because the algorithm must work in such a small amount of time, and must work for arbitrary heights, a first step is to develop a new kind of augmented B-tree data structure in which each node x always carries information about the height of the subtree below x. Describe how to augment the common B-tree insertion and deletion operations to maintain this information, while still maintaining the asymptotic time complexity of all operations. (d) Now give an algorithm for combining two B-trees T1 and T2, in the general case where h1 and h2 are arbitrary. Your algorithm should run in time O(|h1−h2|+1). computernetworkassignmenthelp.com
  • 5. Problem 1. Pattern Matching Suppose you are given a source string S[0 . . n − 1] of length n, consisting of symbols a and b. Suppose further that you are given a pattern string P[0 . . m − 1] of length m « n, consisting of symbols a, b, and ∗, representing a pattern to be found in string S. The symbol ∗ is a “wild card” symbol, which matches a single symbol, either a or b. The other symbols must match exactly. The problem is to output a sorted list M of valid “match positions”, which are positions j in S such that pattern P matches the substring S[j . . j + |P| − 1]. For example, if S = a b a b b a b and P = a b ∗, then the output M should be [0, 2]. (a) Describe a straightforward, na¨ıve algorithm to solve the problem. Your algorithm should run in time O(nm). Solution: One can explicitly check every possible starting position s ∈ {0, 1, . . . , n− m} by checking whether each entry in P matches from s to s + m − 1. computernetworkassignmenthelp.com
  • 6. NAIVE-ALGORITHM(S, P) (b) Give an algorithm to solve the problem by reducing it to the problem of polynomial multiplication. Specifically, describe how to convert strings S and P into polynomials such that the product of the polynomials allows you to determine the answer M. Give examples to illustrate your polynomial representation of the inputs and your way of determining outputs from the product, based on the example S and P strings given above. Solution: Let’s represent a by 1, b by −1, and ∗ by 0. We will use these representations instead of the original symbols in this solution. Notice that P matches S starting from position j, 0 ≤ j ≤ n − m, if and only if for every i, 0 ≤ i ≤ m − 1, either P[i] = 0 or S[j + i]P[i] = 1. This is true if and only if computernetworkassignmenthelp.com
  • 7. where k is the number of non-∗ symbols in P. We would like to express these summations as coefficients of a product of polynomials. Let x be a variable. Represent S as where each Q[i] = P[m − 1 − i]. Thus, we have reversed the order of the coefficients in this last representation. Suppose C is the product of the S polynomial and the P polynomial. Then the coefficient of xm−1+j in C is computernetworkassignmenthelp.com
  • 8. This is the same as the sum above. To obtain the output M, we simply examine all the coefficients of C, outputting position number j, 0 ≤ j ≤ n − m, exactly if the coefficient of xm−1+j is equal to k, the total number of non-∗ symbols in P. We output these in order of increasing j, as required. In the example above, S is represented by computernetworkassignmenthelp.com
  • 9. The number k is equal to 2, so the terms of interest are 2x2, 2x4, and 2x7. These would yield j = 0, 2, 5, but 5 is ruled out because we are only considering j ≤ n − m = 7 − 3 = 4. (c) Suppose you combine your solution to Part (b) with an FFT algorithm for polynomial multiplication, as presented in Lecture 3. What is the time complexity of the resulting solution to the string matching problem? Solution: It’s O(n lg n). It takes time O(n lg n) to perform the needed DFT and inverse DFT algorithms, and O(n) for producing inputs for the DFT algorithm and extracting M from the outputs. d) Now consider the same problem but with a larger symbol alphabet. Specifically, suppose you are given a representation of a DNA strand as a string D[0 . . n−1] of length n, consisting of symbols A, C, G, and T; and you are given a pattern string P[0 . . m − 1] of length m « n, consisting of symbols A, C, G, T, and ∗. The problem is, again, to output a sorted list M of valid “match positions”, which are positions j in D such that pattern P matches the substring D[j . . j + |P| − 1]. For example, if D = A C G A C C A T and P = A C ∗ A, then the output M should be [0, 3]. Based on your solutions to Parts (b) and (c), give an efficient algorithm for this setting. Illustrate your algorithm on the example above. computernetworkassignmenthelp.com
  • 10. Solution: Use a reduction. Encode A as a a, C as a b, G as b a, T as b b, and ∗ as ∗ ∗. Use our previous solution to solve the problem on the resulting string, obtaining a list M' of positions. The final output list M will consist of just the even numbers from the list M' , all divided by 2. This will take the time it takes to convert and then solve the original problem on arrays of length 2n and 2m respectively: Consider a new B-tree operation COMBINE(T1, T2, k). This operation takes as input two B- trees T1 and T2 with the same minimum degree parameter t, plus a new key k that does not appear in either T1 or T2. We assume that all the keys in T1 are strictly smaller than k and all the keys in T2 are strictly larger than k. The COMBINE operation produces a new B-tree T, with the same minimum degree t, whose keys are those in T1, those in T2, plus k. In the process, it destroys the original trees T1 and T2. computernetworkassignmenthelp.com
  • 11. In this problem, you will design an algorithm to implement the COMBINE operation. Your algorithm should run in time O(|h1 − h2| + 1), where h1 and h2 are the heights of trees T1 and T2 respectively. In analyzing the costs, you should regard t as a constant. (a) First consider the special case of the problem in which h1 is assumed to be equal to h2. Give an algorithm to combine the trees that runs in constant time. Solution: Construct a new root node for T consisting of the root nodes for T1 and T2, with the root of T1 at the left, and with k inserted between the keys of the two original roots. Then, if the number of keys in the resulting root node is at least 2t−1 then split the root node around its median, forming a new root node containing one key and two child nodes containing at least t − 1 keys apiece. COMBINE(T1, T2, k) computernetworkassignmenthelp.com
  • 13. (b) Consider another special case, in which h1 is assumed to be exactly equal to h2 + 1. Give a constant-time algorithm to combine the trees. Solution: Append k to the right end of the right child node of T1 and append the root of T2 to that. Clearly this preserves sorted order. Now the right child may have anywhere from t + 1 to 4t − 1 keys. If it has 2t − 1 or more keys, then split it around its median key. If that causes the root node to have 2t − 1 nodes then split that around its median key, thus adding another level to the tree. COMBINE(T1, T2, k) computernetworkassignmenthelp.com
  • 14. (c) Now consider the more general case in which h1 and h2 are arbitrary. Because the algorithm must work in such a small amount of time, and must work for arbitrary heights, a first step is to develop a new kind of augmented B-tree data structure in which each node x always carries information about the height of the subtree below x. Describe how to augment the common B- tree insertion and deletion operations to maintain this information, while still maintaining the asymptotic time complexity of all operations. Solution: Augment the tree by adding a height attribute for each node. The height of a leaf node is 0. For internal nodes, HEIGHT(x) = HEIGHT(x.c1) + 1. Insertion: New nodes are added during splitting. The newly allocated node in a split has the same height as the original node. The only other time a node is added is when the root is split. This is done by making the root the child of a dummy node and then splitting it. The height of the new root is set to one greater than the height of the old root. Deletion: In deletion, no nodes are deleted except the root. Since height values are indexed starting at the leaf, deletion does not affect node heights. With these additions, the asymptotic running time for insertion and deletion is that same as before, O(lg n). computernetworkassignmenthelp.com
  • 15. (d) Now give an algorithm for combining two B-trees T1 and T2, in the general case where h1 and h2 are arbitrary. Your algorithm should run in time O(|h1−h2|+1). Solution: If |h1 − h2| < 2, use part (a) or (b). Otherwise, assume that h1 > h2 + 1 (h2 > h1 + 1 works symmetrically). Let x be the rightmost node of T1 at level h2. Add k at the right end of x and append the root of T2 to that. Now node x may have anywhere from t + 1 to 4t − 1 keys. If it has 2t − 1 or more keys, then split it around its median key. The split may propagate upwards, possibly as far as the root. So, the time complexity depends linearly on the height difference O(|h1 − h2|). COMBINE(T1, T2, k) computernetworkassignmenthelp.com