Skip to content

Insufficient comparator #31

@GauthamBanasandra

Description

@GauthamBanasandra

bool cmp(pt a, pt b) {
return a.y > b.y;
}

The above code fails to provide consistent sorting order when y is the same for different x. For example -
3
3 10
2 10
1 10

Comparator must be -
if(a.y == b.y) { return a.x < b.x; } return a.y > b.y;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions