Duality in algebra and topology