This forum and others see this question a lot and you get answers that range from none - > everything.
So I will point out something that I have noticed, I have never studied and understood any maths that immediately looked useful, but I always seem to find that it is useful later.
[Note: I often started studing some area of maths because I thought it would be useful, but on actually obtaining some understanding I am normally impressed by its beauty but not its usefulness, that comes later]
Other than that, you are going to need lots and lots of maths for those two fields, lots of calculus , functional theory, vector analysis, fourier and Laue transform analysis, group theory, Baysean theory.
Just scratch the surface.
What you haven't really given us is any real idea of how deep your general maths is? Do you need to go from a good base into specialized areas or do you struggle to take the derivative of a one variable function ? If it is only high-school level (basic caculus etc)
you are really going to have to do the equivalent of about 2 year of a university maths course before you can contribute at the algorithm level. However, lots and lots of code can be improved by good software practice but there is both a status and communication problem level between you and the mathematically able co-works on that kind of project.