Though I think pwim may have been pointing that out. There are elements of each discipline that overlap, but you don't need to know any of the physics/mechanics pieces that overlap to get a degree in one, and the same is true of CS/programming.
In fact, you can be an excellent programmer and know no CS, be an excellent mechanic and know no physics, and even be an excellent computer scientist and know nothing that would serve you in a modern programming job. (Obviously you could probably figure it out, but a code monkey would do just as well as some computer scientists.)
But fundamentally they serve different purposes. It's almost conceivable someone could prove P=NP without writing a line of code. Though decreasingly so as computers become so ubiquitous.
But you do need to know about data structures, algorithms, computational complexity, and so on, to write software. You also have to know a lot more -- languages, frameworks, libraries, APIs, and good taste.
(I refuse to use the expression "design patterns", because all design patterns are what people with good taste naturally do without thinking. So have taste and you can skip reading about Flyweight Factory Facades.)