Boyer-Moore example


First attempt
G C A T C G C A G A G A G T A T A C A G T A C G
  1  
G C A G A G A G  

Shift by: 1 (bmGs[7]=bmBc[A]-8+8)

Second attempt
G C A T C G C A G A G A G T A T A C A G T A C G
  3 2 1  
  G C A G A G A G  

Shift by: 4 (bmGs[5]=bmBc[C]-8+6

Third attempt
G C A T C G C A G A G A G T A T A C A G T A C G
  8 7 6 5 4 3 2 1  
  G C A G A G A G  

Shift by: 7 (bmGs[0])

Fourth attempt
G C A T C G C A G A G A G T A T A C A G T A C G
  3 2 1  
  G C A G A G A G  

Shift by: 4 (bmGs[5]=bmBc[C]-8+6)

Fifth attempt
G C A T C G C A G A G A G T A T A C A G T A C G
  2 1
  G C A G A G A G

Shift by: 7 (bmGs[6])

The Boyer-Moore algorithm performs 17 character comparisons on the example.

Boyer-Moore algorithm