Pairwise semi-global alignment is especially useful when a pattern has already been approximately located in a text, and a final alignment is done to obtain the precise alignment. Thus, semi-global alignment is similar to ends-free and global alignment, and the classic methods for global alignment can be applied. is used a lot for pairwise alignment, and it is also useful as a cost for chaining matches: we can lower bound the cost of the alignment between two consecutive matches by the minimal number of horizontal or vertical steps needed to join them (Figure 10).