Contents
Chapter 7 · Data Structure and AlgorithmPractice

LEARN WITH HARU

Video Lesson တွေက Haru အတန်းသားတွေအတွက်ပါ

Haru ရဲ့ ITPEC FE Full Course မှာ ယခု သင်ခန်းစာတွေကို တစ်ခုချင်း တစ်ကြောင်းချင်း အသေးစိတ်ရှင််ရှင်းပြထားပါတယ်

အခြေခံ မရှိတဲ့ ကျောင်းသားများစွာဟာလည်း ဒီ Course နဲ့ ပဲ အောင်မြင်ကုန်ကြပါပြီ

အတန်းမအပ်သေးပဲ Haru ဆီမှာ အစမ်းသင်ကြည့်ချင်ပါသလား?

သင်တန်းသားတွေရဲ့ စကားသံများ

သင်တန်းသားတွေရဲ့ စကားသံများ

Highlighted text? Practice this concept. Highlighted passages and figures open related questions.

Practice related questions (1)Progress & bookmarks

Current section

2-4 Other Algorithms

p. 438

Practice this section 1 linked exam question with default filters

Progress

Not marked complete

Related questions in this lesson 1

Boyer-Moore substring shifting1
Progress and bookmarks

p. 438 · PDF 448

2 - 4 Other Algorithms

2-4-1 Character String Processing

Character string processing is an algorithm that uses characters as the elements of an array. String pattern matching is the main string processing that searches for the target character string from the character strings that are recorded in the array. The basic concept is the same as when numerical values are recorded in the elements of an array. However, since the target value is a character string, it must be confirmed whether multiple elements simultaneously match or not. The easiest concept of string pattern matching is the method of matching a substring (i.e., string that has the same number of characters as the target string) in array elements while one character is shifted from the first at a time.

Original Other Algorithms layout, PDF 448; original source comparison.
Enlarge original visual
Original source text
1) Compare the target string with the substring that is located at the first in array 
elements.
Subject string
A
B
D
A
A
B
C
A
C
C
↑
↑
↑
Target string
A
B
C
2) When the substring does not match, compare after the starting position is shifted by
one character.
Subject string
A
B
D
A
A
B
C
A
C
C
↑
↑
↑
Target string
A
B
C
Source visual description

Original Other Algorithms source layout. Source labels: 1) Compare the target string with the substring that is located at the first in array; elements.; Subject string; A; B.

While this procedure is correct, efficiency is not very good. Therefore, the following Boyer-Moore method was proposed as an effective matching technique of character strings.

p. 439 · PDF 449

Original Other Algorithms layout, PDF 449; original source comparison.
Enlarge original visual
Original source text
1) Compare the target string with the substring that is located at the first in array 
elements.
Subject string
A
B
D
A
A
B
C
A
C
C
↑
↑
↑
Target string
A
B
C
2) When the tail character of the substring does not exist in the target string, make a
comparison after the starting position is shifted by the number of characters in the
target string.
Subject string
A
B
D
A
A
B
C
A
C
C
↑
↑
↑
Target string
A
B
C
3) When the tail character of the substring exists in the target string, make a comparison
by shifting the starting position so that the position of the tail character is matched
with the position of the corresponding character in the target string.
Subject string
A
B
D
A
A
B
C
A
C
C
↑
↑
↑
Target string
A
B
C
Source visual description

Original Other Algorithms source layout. Source labels: 1) Compare the target string with the substring that is located at the first in array; elements.; Subject string; A; B.

Boyer-Moore substring shifting · 1 practice questions

Other than this string pattern matching, the string process includes compression/decompression algorithms of strings, such as the run length method.

Section progress

Original chapter exercises

Original chapter exercises →

New FE Textbook Vol.1 · IT Fundamentals · First Edition, April 2015