Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7443489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:20:13+00:00 2026-05-29T11:20:13+00:00

I am unable to correlate union operation in quick find algorithm with general meaning

  • 0

I am unable to correlate union operation in quick find algorithm with general meaning of A U B in set theory.

Book(Algorithms in C++ Robert Sedgewick) tells union operation is “scanning throgh the whole array for each input pair.(line 9 and 10 in code).

Basically we are copying value at node q to all other nodes having same value as node p.
Why do we name this operation as UNION?

Code is directly copied from the book.

#include <iostream>
const int N = 10000;
int main() {
int i, p, q, id[N];
for( i = 0; i < N; i++ ) id[i] = i;
while( cin >> p >> q ) {
    int t = id[p];
    if ( t = id[q] ) continue;              //quick find operation
    for ( i = 0; i < N; i++ )               //---> union why?
        if ( id[i] == t) id[i] = id[q];
    cout << " " << p << " " << q << endl;
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:20:15+00:00Added an answer on May 29, 2026 at 11:20 am

    The union step in quick find means merging the components with the same id. In a general sense it’s kinda like the union of two sets. You can consider two sets, onw with id1 as id of all its components and another as id2.
    For a great explanation look at this presentation in the quick find section:

    http://www.cs.princeton.edu/~rs/AlgsDS07/01UnionFind.pdf

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Unable to find a SQL diff tool that meets my needs, I am writing
Error: Unable to read data from the transport connection: A blocking operation was interrupted
* Unable to find matching navigation case with from-view-id '/home.xhtml' for action 'MemoServlet' with
I am unable to find the implementation of llvm.pow.f64 function. I want to see
I am unable to find any recent example on how to read EXIF/IPTC information
I'm unable to find file.ReadLine function in Go. How does one read a file
I unable to use put method to send data to particular link.. Please find
I'm unable to find the textbox control in a gridview. And the below code
I was unable to find the google's search widget on the home screen neither
I was unable to find this on php.net. Is the double equal sign (

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.