0% found this document useful (0 votes)
7 views2 pages

Cse2012 PPS9 w2022

Uploaded by

Adi SEHRAWAT
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Cse2012 PPS9 w2022

Uploaded by

Adi SEHRAWAT
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CSE 2012- Design and Analysis of Algorithms

Practice Problem Sheet (Computational


Geometry)

Practice makes you Perfect

1. Given the two end points P1 , P2 of a line segement P1 P2 , design an al-


gorithm to generate n points on P1 P2 . Your algorithm should get the
input n and accordingly output the x-coordinate, y-coordinate of all the
n points. Analyse your algorithm with the time complexity.
2. Given the two end points P1 , P2 of a line segement P1 P2 , and the coor-
dinates of a point q, design an algorithm to check whether the point q in
the clockwise direction from the line segment P1 P2 or not. Analyse your
algorithm with the time complexity.
3. Given the coordinates of n points in a 2-dimensional plane, design an
algorithm to identify the set of points which are collinear. There may be
more than one set of points which are collinear. Your algorithm should
print all the sets of points which are collinear. Analyse your algorithm
with the time complexity.
4. Given the coordinates of the endpoints of two line segments P1 P2 , P3 P4 ,
design an algorithm to check whether the given line segments are parallel
to each other or not. Analyse your algorithm with the time complexity.
5. Given the coordinates of the endpoints of two line segments P1 P2 , P3 P4 ,
design an algorithm to check whether the given line segments are per-
pendicular to each other or not. Analyse your algorithm with the time
complexity.
6. Given the coordinates of the points p1 , p2 , ..., pn and an initial point p0 ,
design a pseudocode to sort the given n points in the increasing order of
their polar angles with respect to the given origin point p0 . Your algorithm
should sort in the increasing order of the angles without measuring the
ploar angle of any point with reference to p0 . Analyse your algorithm with
the time complexity.
7. Given the coordinates of three points A, B, C, design an algorithm to de-
cide whether these vertices form a triangle or not. Analyse your algorithm
with the time complexity.

1
8. Given the coordinates of the end points of n line segments, design an
algorithm to retrun the line segments which intersect. If more than one
pair of line-segments intersect, your algorithm should return all such pairs.
Analyse your algorithm with the time complexity.
9. Given the coordinates of n points, design an algorithm to decide whether
the given n points form a simple polygon or not. Analyse your algorithm
with the time complexity.
10. Given the coordinates of the vertices p1 , p2 , ..., pn of a simple polygon P ,
design an algorithm to check whether the given polygon P is convex or
not. Analyse your algorithm with the time complexity.

11. Given the coordinates of n points p1 , p2 , ..., pn , design an efficient algo-


rithm to identify the pair of points which are farthest from each other.
Pair which are farthest are those pair whose distance from each other is
maximum among the distances of all the pairs formed with the n given
points. Your algorithm should not compute the distance between any two
points for finding the farthest pair of points.
12. Given the coordinates of n points p1 , p2 , ..., pn , design an efficient algo-
rithm to identify the pair of points which are closest to each other. Pair
which are closest are those pair whose distance from each other is mini-
mum among the distances of all the pairs formed with the n given points.
Your algorithm should not compute the distance between any two points
for finding the closest pair of points.
13. The convex hull of a set Q of points is the smallest convex polygon P for
which each point in Q is either on the boundary of P or in its interior.
Design a divide-conquer-combine algorithm to compute the CH(Q)

You might also like