Computer memory is used to temporarily or permanently store data and programs for a computer to use. It represents information using binary digits (bits) of 0s and 1s that can be stored physically using devices like switches, capacitors, magnets, or surfaces with pits. There are different types of computer memory including main memory, magnetic drum memory, magnetic core memory, and semiconductor memory. Main memory has transitioned from using electron tubes and mercury tubes to using magnetic core memory and then semiconductor memory like static RAM and dynamic RAM.