Todos os livros

Profissional

Apps Sobre Coach Entrar Começar a ler

Computer Science · Glossário

O que é Pattern, occurrence?

Também chamado de: pattern (text search) · occurrence

Definition 29.1 High School Computer Science · Capítulo 29 — Searching in Text

In text search, the pattern is the string looked for, of length mm, in a text of length nn. An occurrence of the pattern is a position ii of the text with text[i:i + m] == p. Placing the pattern under the text from position ii is called an alignment; there are n−m+1n - m + 1 of them.

The naive search for plan. Each row is one alignment; the boxed letter is the one compared, the grey letters are never looked at. In ordinary text most alignments fail at the first or second letter, so the search makes a little more than one comparison per position.
The naive search for plan. Each row is one alignment; the boxed letter is the one compared, the grey letters are never looked at. In ordinary text most alignments fail at the first or second letter, so the search makes a little more than one comparison per position.
Ler no capítulo →