# HW_Collection - Fall Semester 2008 CS300 Algorithms...

This preview shows pages 1–3. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

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

Unformatted text preview: Fall Semester 2008 CS300 Algorithms Homework #1 (due 10/06) 1. Take the following list of functions and arrange them in ascending order of growth rate. That is, if function g ( n ) immediately follows function f ( n ) in your list, then it should be the case that f ( n ) is O ( g ( n )). n 2 . 5 , √ 2 n, ( n + 10) , 10 n , 100 n , n 2 log n 2. Assume you have functions f and g such that f ( n ) is O ( g ( n )). For each of the following statements, decide whether you think it is true or false and give a proof or counterexample . (a) 2 f ( n ) is O (2 g ( n ) ). (b) f ( n ) 2 is O ( g ( n ) 2 ). 3. Denote the Euclidean distance between two points p and q by dist( p, q ). In the plane we have dist( p, q ) = q ( p x- q x ) 2 + ( p y- q y ) 2 Let P := { p 1 , p 2 , ··· , p n } be a set of n distinct points in the plane; these points are the sites. We define the Voronoi diagram of P as the subdivision of the plane into n cells, one for each site in P , with the property that a point q lies in the cell corresponding to a site p i if and only if dist( q, p i ) < dist( q, p j ) for each p j ∈ P with j = i . (See Fig. 1). The lower bound on time complexity for a sorting problem is Ω( n log n ), where n is the Figure 1: Voronoi diagram for a set of points P input size. Show that the lower bound of time complexity of computing Voronoi diagrams is Ω( n log n ) from the lower bound for the sorting problem. 1 Fall Semester 2008 CS300 Algorithms Solution #1 1. O ( √ 2 n ) ⊂ O ( n + 10) ⊂ O ( n 2 log n ) ⊂ O ( n 2 . 5 ) ⊂ O (10 n ) ⊂ O (100 n ) 2. (a) False; Take f ( n ) = 2 n and g ( n ) = n . (b) True; Since f ( n ) = O ( g ( n )), there exist some c ∈ R + and some n ∈ N such that f ( n ) ≤ c g ( n ) for all n ≥ n . By noticing that f ( n ) and g ( n ) are functions with nonnegative real values, f ( n ) 2 ≤ c g ( n ) f ( n ) ≤ c 2 g ( n ) 2 . Therefore, there always exist c = c 2 and n such that f ( n ) 2 ≤ cg ( n ) 2 for all n ≥ n . 3. Let us denote by V computing the Voronoi diagram of a given set P and by S sorting problem. To show that the lower bound of V is Ω( n log n ), you need to prove that S can be transformed to V in O ( n ). To do that, you have to find a solution of V after modifying the input of S into that of V and transform it to the adequate solution of S . Since the input of S is [ x 1 , x 2 , ··· , x n ] and the one of V is [( x 1 , y 1 ) , ( x 2 , y 2 ) , ··· ( x n , y n )], you can map each x i to ( x i , 0) in O ( n ). After computing V with this transformed input, we are given the Voronoi diagram which consists of n cells. You can find the leftmost cell in O ( n ). Then by visiting a cell next to the current one and reporting x-coordinate of the site of the cell, you can obtain the solution of S , [ x i 1 , x i 2 , ··· , x i n ] in O ( n ). Therefore S ∝ O ( n ) V and the lower bound L V of V is the following: L V = Ω( n log n )- O ( n ) = Ω( n log n ) [ x 1 ,x 2 , · · · x n ] ( x i 1...
View Full Document

## This note was uploaded on 02/04/2010 for the course COMPUTER S cs300 taught by Professor Unkown during the Spring '08 term at Korea Advanced Institute of Science and Technology.

### Page1 / 34

HW_Collection - Fall Semester 2008 CS300 Algorithms...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online