An introduction to homological algebra