Does any one know of an algorithm to combine two feeds of similar or identical schema?

My plan is to use ATOM but I can transform to RSS if I must.

Ideally I'd like to find a generic algorithm (with code examples would be good in ASP, .NET or PHP [if PERL then it'd have to be fully working and ready to go, I have my limits]).