Algae and fungi live in close association called LICHEN and as you said they benefit each other. This association is called mutualism orsymbiosis. Performs nitrogen fixation which is used by the fungus to synthesize proteins. Algae and fungi live together in a symbiotic relationship as lichens.
Symbiotic relationship is a mutual relationship between two organisms who share food and shelter. In such relationship both the partners are benifitted. In lichen one partner is algae (an autotroph) and other is fungi (a saprotroph). fungi in this association grows on hard rocks and absorb nutrients and water for algae which prepares food and in turn give food to fungi. This relationship can be easily understood by relationship of husband and wife. In which fungi is husband which collects raw material and give it to algae (wife) which prepares food using this raw material which is shared by both the partners.