Question

In a Union Find algorithm, why does path compression make deunion, (undo union), hard? How many...

In a Union Find algorithm, why does path compression make deunion, (undo union), hard?

How many comparisons are needed for Bubblesort and Cocktailsort?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

A union-find algorithm performs two necessary operation which are:

Find: Find particular element in subset.This can be used for finding if two elements are in the same subset.

Union: combine two subsets into a single subset.

Suppose have set of different elements and all of them are in their own set so basically we have called MakeSet on each invididual elements. So, first we do union of set. And make representative to one of the set . but after making union set it really difficult to split into their previous subset. Hence deunion is difficult in union and find path compression algorithm.

No. of comparision needed in Bubble sort:-

If n is total no of elements then,

(n-1)+(n-2)+(n-3)+(n-4)….+2+1=n(n-1)/2

No. of comparision needed in Cocktail sort:-

If n is total no of elements then,

(n(n-1)/2)

Add a comment
Know the answer?
Add Answer to:
In a Union Find algorithm, why does path compression make deunion, (undo union), hard? How many...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT