{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

assignment_05 - code such that it could be easily...

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

View Full Document Right Arrow Icon
CS1102S Data Structures and Algorithms Assignment 05: Graphs and Algorithm Design Techniques Version of Monday 12 th April, 2010, 11:42 Please solve this assignment on paper and indicate your name and matriculation number. Submission deadline is 6:00 pm, on Wednesday, 14/4. Please submit your paper to COM1, 03-28. (under door if necessary) 1. (8 marks) A planar graph is a graph that can be drawn in a plane without any two edges intersecting. Prove that in a planar graph, there must exist some vertex which is connected to no more than five nodes. 2. (10 marks) The diameter of an acyclic undirected graph is the length of the longest path in the graph. Give a linear-time algorithm to determine the diameter of an acyclic undirected graph. Give your algorithm in pseudo-
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: code, such that it could be easily implemented in a real programming language such as Java. Hint: An acyclic undirected graph can be seen as a tree. 3. (6 marks) A Fle contains only colons, spaces, newlines, commas, and digits in the following frequency: colon (100), space (605), newline (100), comma (705), 0 (431), 1 (242), 2 (176), 3 (59), 4 (185), 5 (250), 6 (174), 7 (199), 8 (205), 9 (217). Give an optimal Hu±man code. 4. (5 marks) Give the optimal binary search tree for the following words, where the probability of occurrence is in parentheses: “a” (0.18), “and” (0.19), “i” (0.23), “it” (0.21), “or” (0.19). 1...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online