homework04 - University of Arizona CSc345 (Fall 2011; B....

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: University of Arizona CSc345 (Fall 2011; B. Moon) CSc 345 Homework Assignment #4 Problems 1. (10 pts) Exercise 11.17 in page 401. [Prims algorithm] 2. (10 pts) Exercise 11.18 in page 401. [Kruskals algorithm] 3. (10 pts) Run the Union/Find algorithm to find the least number of equivalence classes for a set of integers from 0 through 15 and a set of related pairs below. (0,2) (1,2) (3,4) (3,1) (3,5) (9,11) (12,14) (3,9) (4,14) (6,7) (8,10) (8,7) (7,0) (10,15) (10,13) You do not have to use optimization techniques such as weighted union and path compression. 4. Run the Insertion sort algorithm on each of the following input sets. In each case, trace through the main loop iterations, show how many comparisons are made, and show how many times data items are moved to a different location. (a) (7 pts) 26 33 35 29 19 12 22 to be sorted into increasing order. (b) (8 pts) 12 19 33 26 29 35 22 to be sorted into increasing order....
View Full Document

Ask a homework question - tutors are online