Docsity

Assignment 6 - Algorithms and Data Structures | CS 2420, Assignments of Computer Science

Toggle sidebar
bg1
CS 2420 - Written 6
Due November 21
1. Perform the following sequence of operations on a disjoint set data
structure:
•union(1,2)
•union(3,4)
•union(3,5)
•union(1,7)
•union(3,6)
•union(8,9)
•union(1,8)
•union(3,10)
•union(3,11)
•union(3,12)
•union(3,13)
•union(14,15)
•union(16,0)
•union(14,16)
•union(1,3)
•union(1,14)
Show the result using the implicit representation as an array (see Fig-
ure 8.5 in the textbook) when the unions are performed
(a) by linking the second tree to the first tree;
(b) by size;
(c) by height.
2. Prove that for every maze generated by the algorithm in Section 8.7,
the path from the starting cell to the ending cell is unique if retracing
is disallowed.
3. Design an algorithm that generates a maze that contains no path from
the starting cell to the ending cell, but has the property that the
removal of a prespecified wall creates a unique path (if retracing is
disallowed).
Submit a single document on eagle.
1

Partial preview of the text

Download Assignment 6 - Algorithms and Data Structures | CS 2420 and more Assignments Computer Science in PDF only on Docsity!

CS 2420 - Written 6 Due November 21

  1. Perform the following sequence of operations on a disjoint set data structure: - union(1,2) - union(3,4) - union(3,5) - union(1,7) - union(3,6) - union(8,9) - union(1,8) - union(3,10) - union(3,11) - union(3,12) - union(3,13) - union(14,15) - union(16,0) - union(14,16) - union(1,3) - union(1,14) Show the result using the implicit representation as an array (see Fig- ure 8.5 in the textbook) when the unions are performed (a) by linking the second tree to the first tree; (b) by size; (c) by height.
  2. Prove that for every maze generated by the algorithm in Section 8.7, the path from the starting cell to the ending cell is unique if retracing is disallowed.
  3. Design an algorithm that generates a maze that contains no path from the starting cell to the ending cell, but has the property that the removal of a prespecified wall creates a unique path (if retracing is disallowed). Submit a single document on eagle.

1