Fixed typos, B-F alg actually runs in O(n*m) time