Capacitor space arrangement algorithm