{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

homework03

# homework03 - outputs “CYCLIC” if G contains a cycle and...

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

University of Arizona CSc345 (Fall 2011; B. Moon) CSc 345 Homework Assignment #3 Problems 1. (10 pts) Exercise 9.14 in page 337. [Closed hashing/linear probing] 2. (10 pts) Show the result of inserting 3, 1, 4, 6, 9, 2, 5, 7 into an initially empty max-heap. You should draw a max-heap ( i.e. , a binary tree) resulted from each insertion. 3. (15 pts) You are given an array of integers 3, 1, 4, 6, 9, 2, 5, 7. Heapify this array to build a max-heap using an O ( n ) algorithm. You should show an array whenever a pair of array elements are swapped. Drawing actual trees is not necessary. 4. (15 pts) Give an algorithm that, given an undirected graph G = ( V,E ) stored in an adjacency list,
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: outputs “CYCLIC” if G contains a cycle, and outputs “ACYCLIC” otherwise. Your algorithm should run in O ( | V | ) time. Explain why your algorithm takes O ( | V | ) time. 5. (10 pts) Exercise 11.1 in page 399. [Proof on graphs] 6. (5 pts) Exercise 11.4 in page 400. [DFS] 7. (5 pts) Exercise 11.6 in page 400. [BFS] 8. (15 pts) Exercise 11.10 in page 400. [Dijkstra’s algorithm] 9. (15 pts) Exercise 16.3 in page 532. [Floyd’s algorithm] Due date This assignment is handed out on Thursday Oct. 13, 2011, and due at 11pm on Monday Oct. 24, 2011. A total of 5 percent of your ±nal grade is allocated for this assignment. 1...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online