Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Ancestor's algorithm

The least common ancestor of two nodes u and ν in a rooted tree T is the node w that is an ancestor of both u and ν and that has the greatest depth in T. In the off-line least-common-ancestors problem, we are given a rooted tree T and an arbitrary set P = {{u, ν}} of unordered pairs of nodes in T, and we wish to determine the least common ancestor of each pair in P. To solve the off-line least-common-ancestors problem, the following procedure performs a tree walk of T with the initial call LCA (T.root). We assume that each node is colored WHITE prior to the walk.

LCA(u)

1 MAKE-SET(u)
2 FIND-SET(u).ancestor = u
3 for each child ν of u in T
4 LCA(ν)
5 UNION(u, ν)
6 FIND-SET(u).ancestor D u
7 u.color = BLACK
8 for each node ν such that {u, ν } ∈P
9 if ν.color = = BLACK
10 print "The least common ancestor of"

u "and" ν "is" FIND-SET(ν).ancestor

a. Argue that line 10 executes exactly once for each pair {u,ν}∈P.

b. Argue that at the time of the call LCA(u), the number of sets in the disjoint-set data structure equals the depth of u in T .

c. Prove that LCA correctly prints the least common ancestor of u and ν for each pair {u, ν} ∈P.

d. Analyze the running time of LCA, assuming that we use the implementation of the disjoint-set data structure in Section 21.3.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91761129
  • Price:- $25

Priced at Now at $25, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Question you recently joined a local cyber security hackers

Question: You recently joined a local cyber security "hackers" group that meets once a month to discuss recent cyber security related events, as well as tools and techniques. You have offered to present at the next meeti ...

Please discuss the design principles that guide the authors

Please discuss the design principles that guide the authors of instruction sets in making the right balance. Provide examples of application of each of the three design principles while designing instruction sets.

Research web server vulnerabilities by choosing a site and

Research web server vulnerabilities by choosing a site and determining what kind of platform it is running on. Do not scan the server, you can use a site such as Netcraft to determine what the website is running. See if ...

After reading this weeks materials please respond to two 2

After reading this week's materials, please respond to TWO (2) of the following questions. PROVIDE CITATION IN APA 1. Describe the controls contained within the three Access Control categories that can be integrated with ...

Question suppose message a is one block long suppose that

Question : Suppose message (a) is one block long. Suppose that an attacker has received the MAC (t) for a using CBC-MAC under some random key unknown to the attacker. Explain how to forge the MAC for a two-block message ...

Analyze the time complexity of the following ternary search

Analyze the time complexity of the following ternary search algorithm: identify two points that subdivide a sorted array into three parts. If the given number is equal to one of these two points, we are done. Otherwise, ...

Question task 1 use examples from the readings or from your

Question: Task 1: Use examples from the readings, or from your own research, to support your views, as appropriate. Encouraged to conduct research and use other sources to support your answers. Be sure to list your refer ...

1 a consumer has 300 to spend on goods x and y the market

1. A consumer has $300 to spend on goods X and Y. The market prices of these two goods are Px $15 and Py $5. a. What is the market rate of substitution between goods X and Y? b. Show how the consumer's opportunity set ch ...

Enter probability as a fraction or as a decimal rounded to

Enter probability as a fraction or as a decimal rounded to nearest thousandth (three A basket contains six red and four blue marbles. Three marbles are drawn at random without replacement. (WITHOUT using combinations) de ...

Question write a 2 page briefing paper in which you present

Question: Write a 2 page briefing paper in which you present a summary of the issues (including a description of the types of intellectual property which may have been stolen). You should then summarize your research int ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As