# K-set (geometry)

In discrete geometry, a $k$-set of a finite point set $S$ in the Euclidean plane is a subset of $k$ elements of $S$ that can be strictly separated from the remaining points by a line. More generally, in Euclidean space of higher dimensions, a $k$-set of a finite point set is a subset of $k$ elements that can be separated from the remaining points by a hyperplane. In particular, when $k=n/2$ (where $n$ is the size of $S$), the line or hyperplane that separates a $k$-set from the rest of $S$ is a halving line or halving plane.
The $k$-sets of a set of points in the plane are related by projective duality to the $k$-levels in an arrangement of lines. The $k$-level in an arrangement of $n$ lines in the plane is the curve consisting of the points that lie on one of the lines and have exactly $k$ lines below them. Discrete and computational geometers have also studied levels in arrangements of more general kinds of curves and surfaces.

## Combinatorial bounds

$n$
It is of importance in the analysis of geometric algorithms to bound the number of $k$-sets of a planar point set, or equivalently the number of $k$-levels of a planar line arrangement, a problem first studied by Lovász and Erdős et al. The best known upper bound for this problem is $O(nk^{1/3})$, as was shown by Tamal Dey using the crossing number inequality of Ajtai, Chvátal, Newborn, and Szemerédi. However, the best known lower bound is far from Dey's upper bound: it is Ω(nc$^{√(log⁡k)}$){\textstyle \Omega (nc^{\sqrt {\log k}})} for some constant $c$, as shown by Tóth.
In three dimensions, the best upper bound known is $O(nk^{3/2})$, and the best lower bound known is Ω(nkc$^{√(log⁡k)}$){\textstyle \Omega (nkc^{\sqrt {\log k}})}. For points in three dimensions that are in convex position, that is, are the vertices of some convex polytope, the number of $k$-sets is $\Theta {\bigl(n-k)k{\bigr )}$, which follows from arguments used for bounding the complexity of $k$th order Voronoi diagrams.
For the case when $k=n/2$ (halving lines), the maximum number of combinatorially distinct lines through two points of $S$ that bisect the remaining points when $k=1,2,\dots$ is
Bounds have also been proven on the number of $\leq k$-sets, where a $\leq k$-set is a $j$-set for some $j\leq k$. In two dimensions, the maximum number of $\leq k$-sets is exactly $nk$, while in $d$ dimensions the bound is $O(n^{\lfloor d/2\rfloor }k^{\lceil d/2\rceil })$.

## Construction algorithms

Edelsbrunner and Welzl first studied the problem of constructing all $k$-sets of an input point set, or dually of constructing the $k$-level of an arrangement. The $k$-level version of their algorithm can be viewed as a plane sweep algorithm that constructs the level in left-to-right order. Viewed in terms of $k$-sets of point sets, their algorithm maintains a dynamic convex hull for the points on each side of a separating line, repeatedly finds a bitangent of these two hulls, and moves each of the two points of tangency to the opposite hull. Chan surveys subsequent results on this problem, and shows that it can be solved in time proportional to Dey's $O(nk^{1/3})$ bound on the complexity of the $k$-level.
Agarwal and Matoušek describe algorithms for efficiently constructing an approximate level; that is, a curve that passes between the $(k-\delta )$-level and the $(k+\delta )$-level for some small approximation parameter $\delta$. They show that such an approximation can be found, consisting of a number of line segments that depends only on $n/\delta$ and not on $n$ or $k$.

## Matroid generalizations

The planar $k$-level problem can be generalized to one of parametric optimization in a matroid: one is given a matroid in which each element is weighted by a linear function of a parameter $\lambda$, and must find the minimum weight basis of the matroid for each possible value of $\lambda$. If one graphs the weight functions as lines in a plane, the $k$-level of the arrangement of these lines graphs as a function of $\lambda$ the weight of the largest element in an optimal basis in a uniform matroid, and Dey showed that his $O(nk^{1/3})$ bound on the complexity of the $k$-level could be generalized to count the number of distinct optimal bases of any matroid with $n$ elements and rank $k$.
For instance, the same $O(nk^{1/3})$ upper bound holds for counting the number of different minimum spanning trees formed in a graph with $n$ edges and $k$ vertices, when the edges have weights that vary linearly with a parameter $\lambda$. This parametric minimum spanning tree problem has been studied by various authors and can be used to solve other bicriterion spanning tree optimization problems.
However, the best known lower bound for the parametric minimum spanning tree problem is $\Omega (n\log k)$, a weaker bound than that for the $k$-set problem. For more general matroids, Dey's $O(nk^{1/3})$ upper bound has a matching lower bound.