Explain how the activities of autotrophs and heterotrophs enable the flow of energy within an ecosystem.