Books on bioinformatics algorithms
Here are a couple books I'd recommend:

Dan Gusfield's Algorithms on Strings, Trees, and Sequences is a deep and wide treatment of aligning, searching, and processing strings, trees, and sequences.

Warren Ewens' Statistical Methods in Bioinformatics devotes a chapter to BLAST and the math underneath it.

Edit - Another book that may be useful for some mathematical underpinnings would be Michael S. Waterman's Introduction to Computational Biology.