If you want to mix proprietary software with free software then copyleft is not your
answer. Permissive licenses such as Apache 2.0/BSD/MIT is what you are looking for.
A note about your algorithm example; Algorithms as the ideas per se are not protected by
copyright. Meaning, even if you publish your algorithm under a proprietary license; That
doesn't stop anyone else from writing a white paper in plain English or in
mathematical notation about what the algorithm is supposed to do, then someone else can
reimplement that algorithm under any license of their choice.