What is the basic difference between a k-median problem and a k-center problem? Are they in any way connected to service facility location problem and emergency location problem? If so, which is connected to which?

PS. It would really help if you can give me a simple example and algorithm for solving these problems.