Charging batteries and how voltage affects it
The first diagram doesn't work, since you'd have a short circuit (look at the red/blue lines near the interconnect between the two 3-cell holders - they are shorted through this interconnect):



The second diagram also doesn't work, since 5 volts is not enough to push charge through 8 cells; the voltage of the 5-volt battery would be lower than the battery pack, thus the diode will be reverse-biased.

If you do want a solution similar to your second diagram, you can use that, but provide higher voltage — around 12V — and place a series resistor instead of the diode. Select the resistor so that it limits the charge current to a lowish value when the pack is fully charged (20 mA or less is probably fine), since if there's no human around to monitor things, you'll continue pushing that current even when there's nothing more to charge, which only heats and degrades the cells. If the current were larger, the cells would be damaged quickly.