Gallery using linear partition algorithm.