Capacitor charging and discharging depends on