Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The total work done by an algorithm is the product of the runtime of a single iteration and the number of iterations performed. If I

The total work done by an algorithm is the product of the runtime of a single iteration and the number of iterations performed. If I have an algorithm that takes t time for a single iteration and I run the algorithm 10 times, I do 10t work in total.

Suppose you are given a string's size in terms of n, where n is some number. You can figure out the runtime of a single iteration of your algorithm in terms of n. Then suppose you're given a target amount of work, also in terms of n, and told to figure out the number of iterations needed to meet that amount of work. A mathematically convenient way to do that would be put your number of iterations in terms of n, say nb where b is some number, and then solve for b.

Q1. You are given a Text of length n8. How many times would you need to search the tree for a pattern of size n to do the same amount of work as building the tree?

Assume that the number of matches per search is much less than n.

Give your answer in terms of power of n. e.g. n9 would be 9.

Q2. You are given a Text of length n7 and x Patterns of size n. How big does x need to be in order for it to be as asymptotically efficient to use a suffix tree as it is to use the z-algorithm.

Assume that the number of matches per search is much less than n.

Give your answer in terms of power of n. e.g. n3 would be 3.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions