Category - pattern searching Algorithm