getLeftmost function

Node? getLeftmost(
  1. Node start
)

Implementation

Node? getLeftmost(Node start) {
  Node p = start;
  Node leftmost = start;
  do {
    if (p.x < leftmost.x || (p.x == leftmost.x && p.y < leftmost.y)) {
      leftmost = p;
    }
    p = p.next!;
  } while (p != start);

  return leftmost;
}