Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Wedding problem This assignment asks you to write a program in Java (or another language you choose) to find disjoint groups in a set of

Wedding problem image text in transcribed
This assignment asks you to write a program in Java (or another language you choose) to find disjoint groups in a set of data. Here is the story Tomorrow is Jack&Lucy's wedding day They have a lot of friends who will attend their wedding, Afterwards, they will have dinner together, so lack & tucy want to know minimum number of tables they need to setup. And you must consaider that not all the friends know each other, and friends do not want to sit with strangers One rule for this is that if I tell you A knows B, and B knows C, that means A, B, C know each other (Le., "X knows Y" is a transitive relationship), so they can sit on the sarne table. For example, if I tell you A knows B, B knows C. and D knows E, so A, B, Ccan sit on one table, and D, E must sit on another table. Therefore, this instance needs at least 2 tables. Input: Your program reads inputs from a file. The file starts with a line of two integers N and M (1c N, Mc 1000). N indicates the number of friends; the friends are marked from 1 to N. Then M lines follow. Each line consists of two integers A and B (A - B), that means friend A and friend B know each other. Output: Output how many tables they need at least. Sample Input: s 3 1 2 2 3 4 5 Sample Output: Prepare an for name of the input file and run on that input file input file in addition to your Java program. Your program should prompt the user

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

state what is meant by the term performance management

Answered: 1 week ago