English

A Smart Backtracking Algorithm for Computing Set Partitions with Parts of Certain Sizes

Data Structures and Algorithms 2021-02-04 v2

Abstract

Let α={a1,a2,a3,...,an}\alpha=\{a_1,a_2,a_3,...,a_n\} be a set of elements, δ<n\delta < n be a non-negative integer, and Γ:α{0,1,2,...,n}\Gamma: \alpha \to \{0, 1, 2, ..., n\} be a total mapping. Then, we call Γ\Gamma a \emph{partition} of α\alpha if and only if for all xαx \in \alpha, Γ(x)0\Gamma(x) \neq 0. Further, we call Γ\Gamma a δ\delta-\emph{partition} of α\alpha if and only if Γ\Gamma is a partition of α\alpha and for all i{1,2,3,...,n}i \in \{1, 2, 3, ..., n\}, {x:Γ(x)=i}>δ|\{x: \Gamma(x)=i\}| > \delta. We give a non-trivial algorithm that computes all δ\delta-partitions of α\alpha in Ω(n)\Omega(n) time. On the opposite, a naive generate-and-test algorithm would compute all δ\delta-partitions of α\alpha in Ω(nBn)\Omega(nB_n) time where BnB_n is the Bell number.

Cite

@article{arxiv.2011.03004,
  title  = {A Smart Backtracking Algorithm for Computing Set Partitions with Parts of Certain Sizes},
  author = {Samer Nofal},
  journal= {arXiv preprint arXiv:2011.03004},
  year   = {2021}
}
R2 v1 2026-06-23T19:56:45.832Z