In this project, you are asked to scan an input set of points in the plane in the order of their polar angles with respect to a reference point. This reference point, called the median coordinate point (MCP), has its x-coordinate equal to the median of the x-coordinates of the input points and its y-coordinate equal to the median of their y-coordinates. A polar angle with respect to this point lies in the range [0, 2π). Finding the median x- and y-coordinates is done by sorting the points separately by the corresponding coordinate.1 Once the MCP has been constructed, a third round of sorting will be conducted by the polar angle with respect to this point. You need to scan the input points four times, each time using one of the four sorting algorithms presented in class: selection sort, insertion sort, merge sort, and quicksort. Note that the same sorting algorithm must be used in all three rounds of sorting within one scan. We make the following two assumptions: • All input points have integer coordinates ranging between −50 and 50, inclusive. • The input points may have duplicates. Integer coordinates are assumed to avoid issues with floating-point arithmetic. The rectangular range [−50, 50] × [−50, 50] is big enough to contain 10,201 points with integer coordinates. Since the input points will be either generated as pseudo-random points or read from an input file, duplicates may appear. Also, it is unnecessary to test your code on more than 10,201 input points (otherwise duplicates will certainly arise).
Stars
0
Forks
0
Watchers
0
Open Issues
0
Overall repository health assessment
No language data available
No package.json found
This might not be a Node.js project
1
commits