I would start with Don Knuth's "Fundamental Algorithms" it is the first volume in TAoCP series. It introduces most of the maths you will need. The alternative is "Concrete Mathematics" by Graham, Knuth and Patashnik, which covers more material and in greater depth.

.