homework04

# homework04 - University of Arizona CSc345(Fall 2011 B Moon...

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

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. [Prim’s algorithm] 2. (10 pts) Exercise 11.18 in page 401. [Kruskal’s 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

## This note was uploaded on 02/28/2012 for the course CSC 345 taught by Professor Moon during the Fall '11 term at Arizona.

Ask a homework question - tutors are online