K-adaptive partitioning algorithm