The intersection detection problem for a set S of n line
segments is to determine whether there exists a pair of
segments in S that intersect. Give a plane sweep algorithm
that
solves the intersection detection problem in O(nlogn) time.
Prove it only requires O(nlogn) time.
Answer:-----------
Plane sweep algorithm:--------------
Intersect(S) :
Analysis: The work done by the algorithm is dominated by the time spent updating the various data structures (since otherwise we spend only constant time per sweep event). We need to count two things: the number of operations applied to each data structure and the amount of time needed to process each operation. For the sweep line status, there are at most n elements intersecting the sweep line at any time, and therefore the time needed to perform any single operation is O(log n), from standard results on balanced binary trees. Since we do not allow duplicate events to exist in the event queue, the total number of elements in the queue at any time is at most 2n + I. Since we use a balanced binary tree to store the event queue, each operation takes time at most logarithmic in the size of the queue, which is
O(log(2n + I)). Since I <= n2 , this is at most
O(log(n2) ) = O(2 log n) = O(log n) time.
The intersection detection problem for a set S of n line segments is to determine whether...
Let L be a set of n lines in the plane. Give an O(nlogn) time
algorithm to compute an axis-parallel rectangle that contains all
the intersection points of those n lines in the plane.
Give an example of a set of n line segments with an order on them that makes the algorithm create a search structure of size Θ(n2) and worst-case query time Θ(n).
Let S be a set of disjoint simple polygons in the plane with n edges in total. Prove that for any start and goal position the number of segments on the shortest path is bounded by O(n). Give an example where it is Θ(n).
Let S be a set of disjoint simple polygons in the plane with n edges in total. Prove that for any start and goal position the number of segments on the shortest path is bounded by O(n). Give an example where it is Θ(n).
What is the set of event points S for the sweepline algorithm for the problem of reporting all intersections among a set of n segments? O S-(The intersections ) O S -(The endpoints of the segments and all intersections ) O s-(The endpoints of the segments) O s -( The startpoints of the segments )
Question 8, please.
2. Prove: (a) the set of even numbers is countable. (b i=1 3. The binary relation on pair integers - given by (a,b) - (c,d) iff a.d=cbis an equivalence relation. 4. Given a graph G = (V, E) and two vertices s,t EV, give the algorithm from class to determine a path from s to t in G if it exists. 5. (a) Draw a DFA for the language: ( w w has 010 as a substring)....
def count_overlapping_disks(disks): Right on the heels of the previous Manhattan skyline problem, another classic problem of similar spirit that is here best solved with a sweepline algorithm. Given a list of disks on the two-dimensional plane as tuples (x, y, r) so that (x, y) is the center point and r is the radius of that disk, count how many pairs of disks intersect each other in that their areas, including the edge, have at least one point in common....
If it exists, determine the supremum of following set. Must
prove answer.
S = (n/n +1: neN
1) Consider the clique problem: given a graph G (V, E) and a positive integer k, determine whether the graph contains a clique of size k, i.e., a set of k vertices S of V such that each pair of vertices of S are neighbours to each other. Design an exhaustive-search algorithm for this problem. Compute also the time complexity of your algorithm.
Consider the following problem: Section II Con n a truth function f, find a statement S, only intolring the connecti e, ^,V and whose trva function is j. (a) Exhibit an algorithm that solves this problem. (b) Applied the exhibited algorithm to the truth function, 1 given by: TITIT (c) Suppose that the truth function f has n arguments represented by the variables i Consider the first algorithm studied in class to solve the problem of item (a). Let 01,92,.......