Expain this question

If we use trees with the union-by-rank algorithm, what is the worst case running time for checking if two elements are in same set or not?

Hello @hssharma2212000 do you know about the union by rank algorithm?
it is used to detect cycles in the graph whether it is present or not.
and its answer is O(logn).
Happy Learning!!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.