This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “Disjoint-Set Data Structure”.

1. How many properties will an equivalent relationship satisfy?

a) 1

b) 2

c) 3

d) 4

View Answer

Explanation: An equivalent relationship will satisfy three properties – reflexive, symmetric and transitive.

2. A relation R on a set S, defined as x R y if and only if y R x. This is an example of?

a) reflexive relation

b) symmetric relation

c) transitive relation

d) invalid relation

View Answer

Explanation: A symmetric property in an equivalence relation is defined as x R y if and only y R x.

3. Electrical connectivity is an example of equivalence relation.

a) true

b) false

View Answer

Explanation: Electrical connectivity is reflexive, symmetric and also transitive. Hence, electrical connectivity is an equivalence relation.

4. What is the worst case efficiency for a path compression algorithm?

a) O(N)

b) O(log N)

c) O(N log N)

d) O(M log N)

View Answer

Explanation: The worst case efficiency for a path compression algorithm is mathematically found to be O(M log N).

5. Path Compression algorithm performs in which of the following operations?

a) Create operation

b) Insert operation

c) Find operation

d) Delete operation

View Answer

Explanation: Path compression algorithm is performed during find operation and is independent of the strategy used to perform unions.

6. What is the definition for Ackermann’s function?

a) A(1,i) = i+1 for i>=1

b) A(i,j) = i+j for i>=j

c) A(i,j) = i+j for i = j

d) A(1,i) = i+1 for i<1

View Answer

Explanation: The Ackermann’s function is defined as A(1,i) = i+1 for i>=1. This form in text grows faster and the inverse is slower.

7. ___________ is one of the earliest forms of a self-adjustment strategy used in splay trees, skew heaps.

a) Union by rank

b) Equivalence function

c) Dynamic function

d) Path compression

View Answer

Explanation: Path compression is one of the earliest forms of self-adjustment used in extremely important strategies using theoretical explanations.

8. What is the depth of any tree if the union operation is performed by height?

a) O(N)

b) O(log N)

c) O(N log N)

d) O(M log N)

View Answer

Explanation: If the Unions are performed by height, the depth of any tree is calculated to be O(log N).

9. When executing a sequence of Unions, a node of rank r must have at least 2^{r} descendants.

a) true

b) false

View Answer

Explanation: By the induction hypothesis, each tree has at least 2

^{r – 1}descendants, giving a total of 2

^{r}and establishing the lemma.

10. What is the value for the number of nodes of rank r?

a) N

b) N/2

c) N/2^{r}

d) N^{r}

View Answer

Explanation: Each node of a rank r is the root of a subtree of at least 2

^{r}. Therefore, there are at most N/2

^{r}disjoint subtrees.

11. What is the worst-case running time of unions done by size and path compression?

a) O(N)

b) O(logN)

c) O(N logN)

d) O(M logN)

View Answer

Explanation: The worst case running time of a union operation done by size and path compression is mathematically found to be O(M logN).

12. In the Union/Find algorithm, the ranks of the nodes on a path will increase monotonically from?

a) leaf to root

b) root to node

c) root to leaf

d) left subtree to right subtree

View Answer

Explanation: One of the lemmas state that, in the Union/Find algorithm, the ranks of the nodes on a path will increase monotonically from leaf to root.

13. How many strategies are followed to solve a dynamic equivalence problem?

a) 1

b) 2

c) 3

d) 4

View Answer

Explanation: There are two strategies involved to solve a dynamic equivalence problem- executing find instruction in worst-case time and executing union instruction in worst-case time.

14. What is the total time spent for N-1 merges in a dynamic equivalence problem?

a) O(N)

b) O(log N)

c) O(N log N)

d) O(M log N)

View Answer

Explanation: The total time spent for N-1 merges in a dynamic equivalence problem is mathematically found to be O(N log N).

15. What is the condition for an equivalence relation if two cities are related within a country?

a) the two cities should have a one-way connection

b) the two cities should have a two-way connection

c) the two cities should be in different countries

d) no equivalence relation will exist between two cities

View Answer

Explanation: If the two towns are in the same country and have a two-way road connection between them, it satisfies equivalence property.

**Sanfoundry Global Education & Learning Series – Data Structure.**

To practice all areas of Data Structure, __here is complete set of 1000+ Multiple Choice Questions and Answers__.

**Next Steps:**

- Get Free Certificate of Merit in Data Structure I
- Participate in Data Structure I Certification Contest
- Become a Top Ranker in Data Structure I
- Take Data Structure I Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

**Related Posts:**

- Practice Computer Science MCQs
- Practice Design & Analysis of Algorithms MCQ
- Buy Data Structure Books
- Apply for Data Structure Internship
- Buy Computer Science Books