# 6.3. Quiz

## Implementation

* Create the [`DisjointSetQuiz`](https://github.com/emory-courses/dsa-java/blob/master/src/main/java/edu/emory/cs/set/DisjointSetQuiz.java) class under the [`set`](https://github.com/emory-courses/dsa-java/blob/master/src/main/java/edu/emory/cs/set) package.
* Assume that the [`find()`](https://github.com/emory-courses/dsa-java/blob/master/src/main/java/edu/emory/cs/set/DisjointSet.java#L39) method in the `DisjointSet` class uses the baseline approach:

  ```java
  public int find(int id) {
      return (subsets[id] < 0) ? id : find(subsets[id]);
  }
  ```
* A disjoint set can be represented by a tree.  Update the [`main()`](https://github.com/emory-courses/dsa-java/blob/master/src/main/java/edu/emory/cs/set/DisjointSetQuiz.java#L20) method in the `DisjointSetQuiz` class that would result the following tree:

![](/files/-MK__JAi_SAtabbeTlG_)

## Report

Write a report `quiz6.pdf` that includes the followings:

* Describe how the values in the [`subsets[]`](https://github.com/emory-courses/dsa-java/blob/master/src/main/java/edu/emory/cs/set/DisjointSet.java#L24) array changes after each call in the `main()` method.
* Describe how the values in the [`subsets[]`](https://github.com/emory-courses/dsa-java/blob/master/src/main/java/edu/emory/cs/set/DisjointSet.java#L24) array would change after calling `find(0)` once all keys are added as above, assuming that the `find()` method in `DisjointSet` class uses the efficient approach:

  ```java
  public int find(int id) {
      return (subsets[id] < 0) ? id : (subsets[id] = find(subsets[id]));
  }
  ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://emory.gitbook.io/dsa-java/disjoint-sets/exercises.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
