Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. The uptrees used to represent sets in the union-find algorithm can be stored in two n-element arrays The up array stores the parent of

image text in transcribed

2. The uptrees used to represent sets in the union-find algorithm can be stored in two n-element arrays The up array stores the parent of each node (or-1 if it has no parent). The weight array stores the number of items in a set if the node is the representative node of a set (else the weight entry for the node does not matter and can be anything) The following shows a collection of sets containing the numbers 1 through 12, without the weight array filled in 1 101 9 11-1 weight 9 10 12 a) b) c) Draw a picture of the uptrees represented by the data in the up array shown above Fill in the weight array above so that all entries that need to be correct are correct. Suppose we did not keep the weight array updated as operations are performed. As you did in part (a), the algorithm could compute weights as needed. Would this asymptotically slow down find operations that use path compression? Suppose we did not keep the weight array updated as operations are performed. As you did in part (a), the algorithm could compute weights as needed. Would this asymptotically slow down union operations that use union-by-weight? Show the result of performing the operation find(4) with path compression by doing both of the following d) e) Redraw below any uptrees (from part (a)) that change as a result. Update the array representation as appropriate by drawing a single slash (V") through any numbers that change and writing the new number next to it

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions

Question

Derive expressions for the rates of forward and reverse reactions?

Answered: 1 week ago

Question

Write an expression for half-life and explain it with a diagram.

Answered: 1 week ago

Question

What do you mean by underwriting of shares ?

Answered: 1 week ago

Question

Define "Rights Issue".

Answered: 1 week ago