Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geometry - Wrong order in result after sorting #100

Open
wahyudierwin opened this issue Apr 17, 2022 · 0 comments
Open

Geometry - Wrong order in result after sorting #100

wahyudierwin opened this issue Apr 17, 2022 · 0 comments

Comments

@wahyudierwin
Copy link

wahyudierwin commented Apr 17, 2022

In this main code,

point[] P = new point[6];
P[0] = new point(2, 2);
P[1] = new point(4, 3);
P[2] = new point(2, 4);
P[3] = new point(6, 6);
P[4] = new point(2, 6);
P[5] = new point(6, 5);

i changed into

point[] P = new point[7];
P[0] = new point(3.6, 4.5);
P[1] = new point(0, 2);
P[2] = new point(1.75, 6.75);
P[3] = new point(2.4, 3);
P[4] = new point(5.6, 5.8);
P[5] = new point(0.5, 1.5);
P[6] = new point(4.75, 2.1);

And the result after Arrays.sort(P) is

(0.00, 2.00)
(0.50, 1.50)
(1.75, 6.75)
(2.40, 3.00)
(3.60, 4.50)
(5.60, 5.80)
(4.75, 2.10)

Shouldn't the (4.75, 2.10) appear before (5.60, 5.80)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant