Alle boeken

Professioneel

Apps Over Coach Inloggen Begin met lezen

Computer Science · Begrippenlijst

Wat is Pattern, occurrence?

Ook bekend als: pattern (text search) · occurrence

Definition 29.1 High School Computer Science · Hoofdstuk 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.
Lees in het hoofdstuk →