Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your goal for this assignment is to create a tool that manages an equivalence relation that can be changed in a specific way by the

Your goal for this assignment is to create a tool that manages an equivalence relation that can be changed in a specific way by the program while the program runs. The assignment will involve two files, equiv.h and equiv.cpp. For this assignment, the equivalence relation is always over a set of integers {1, 2, 3, , n} for some positive integer n. This tool is not a complete program. It is intended to be part of a larger program. File equiv.cpp must not define a main function. Interface The interface tells exactly what this module provides for other modules to use. Other modules must not use anything that is not described here. For this assignment, an equivalence relation has type ER. A module that uses this tool can create an equivalence relation called R by saying ER R = newER(n); where n is a positive integer. Initially, each number is in its own equivalence class; the equivalence classes are {1}, {2}, , {n}. There are two operations that can be performed. equivalent(R, x, y) returns a boolean value: true if x and y are currently in the same equivalence class in equivalence relation R, and false otherwise. merge(R, x, y) modifies equivalence relation R by making x and y equivalent. It combines the equivalence class that contains x with the equivalence class that contains y. The merge function does not return an answer.

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

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions