This preview shows pages 1–2. Sign up to view the full content.
CSE 2320001 Lab Assignment 1
Due February 14, 2012
Goals:
1.
Application of sorting.
2.
Application of binary search.
Requirements:
1.
Design, code, and test a C program to perform
range queries
for two dimensional point data.
The first
line of the input will be
n
, the number of integer coordinate pairs in the next
n
input lines.
n
will not
exceed 5000.
Each of the remaining lines will have four values giving the coordinates of the lower
left point and upper right point of a
bounding box
.
The last input line will be
1 1 1 1
.
All
input point coordinates will be in the range
0 .
. 1000
, inclusive.
The input should be read from
standard input (
stdin
).
Your code should preprocess (sort) the points and use O(
m
+ log
n
) time to
process each query, where
m
is the the number of points in the smaller of the horizontal and vertical
“slabs”.
For each query you should output 1)
m
,
2) the coordinates of the points in the answer, and 3)
the number of points in the answer.
2.
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.
 Spring '12
 BOBWEEMS
 Binary Search, Sort

Click to edit the document details