Submit to Blackboard before the deadline. You will be able to revise your answers until the deadline with no penalty.
IMPORTANT: By submitting your answers, you are certifying that these answers have been exclusively your own work. All students enrolled in this course are expected to adhere to the UT Arlington Honor Code:
I pledge, on my honor, to uphold UT Arlington's tradition of academic integrity, a tradition that values hard work and honest effort in the pursuit of academic excellence. I promise that I will submit only work that I personally create or contribute to group collaborations, and I will appropriately reference any work from other sources. I will follow the highest standards of integrity and uphold the spirit of the Honor Code.
Give the output that a connectivity algorithm should produce when given the input 0-2, 1-4, 2-5, 3-6, 0-4, 6-0, and 1-3.
Write a program that implements the quick-find slow-union solution, and that also prints out, after processing each link, how many sets are remaining. You can write your program from scratch, or you can modify program find_union1b.c. Save your program as task2.c
(or replace .c by the appropriate file extension for your programming language).
Show the contents of the id array after each union operation when you use the quick-find algorithm (Program 1.1) to solve the connectivity problem for the sequence 0-2, 1-4, 2-5, 3-6, 0-4, 6-0, and 1-3. Also give the number of times the program accesses the id array for each input pair.
Give the contents of the id array after each union operation for the weighted quick-union algorithm running on the examples corresponding to Figure 1.7 and Figure 1.8.
Show the contents of the id array after each union operation when you use the weighted quick-union algorithm (Program 1.3) to solve the connectivity problem for the sequence 0-2, 1-4, 2-5, 3-6, 0-4, 6-0, and 1-3. Also give the number of times the program accesses the id array for each input pair.
Estimate the minimum amount of time (in days) that would be required for quick find (Program 1.1)
to solve a problem with 109 objects and 106 input pairs, on a computer capable of executing 109
instructions per second. Assume that each iteration of the for
loop requires at least 10 instructions.
Estimate the maximum amount of time (in seconds) that would be required for weighted quick
union (Program 1.3) to solve a problem with 109 objects and 106 input pairs, on a computer capable of
executing 109 instructions per second. Assume that each iteration of the while
loop requires at most
100 instructions.
Give a sequence of input pairs that causes the weighted quick-union algorithm (Program 1.3) to produce a path of length 4.
Modify Program 1.3 to implement full path compression, where we complete each union operation by making every node that we touch link to the root of the new tree. You can write your program from scratch, or you can modify program find_union4b.c. Save your program as task9.c
(or replace .c by the appropriate file extension for your programming language).
Give an example showing that modifying quick union (Program 1.3) to implement full path compression (see Exercise 1.16) is not sufficient to ensure that the trees have no long paths.
The assignment should be submitted via Blackboard. Submit a ZIPPED directory called assignment.zip. No other forms of compression accepted, contact the instructor or TA if you do not know how to produce .zip files. The zipped directory should contain the following documents:
IMPORTANT: Pay close attention to all specifications on this page, including file names and submission format. Even in cases where your answers are correct, points will be taken off liberally for non-compliance with the instructions given on this page (such as wrong file names, wrong compression format for the submitted code, and so on). The reason is that non-compliance with the instructions makes the grading process significantly (and unnecessarily) more time consuming. Contact the instructor or TA if you have any questions.
Back to the list of assignments.