As long as you avoid National Week, crowds should be manageable in October, any day, except maybe a Saturday, and even then, probably not so bad.
Weather in October in Shanghai is still pretty nice, though rain is a concern! Pack a nice jacket! For Beijing, it's more difficult to say, though...