The Dow Jones Industrial Average gained 311 points on Tuesday, largely erasing losses from Monday, as tech stocks rebounded.