Skip to content

Algorithm Playground

Step a matching algorithm over your own text and pattern, and inspect its state at every comparison.

Simulator Configuration

Live Stats

Matches1
Iterations51

Decision History

#1Checking for match at index 0
#2Comparing text[0] ('A') with pattern[0] ('A')
#3Comparing text[1] ('B') with pattern[1] ('B')
#4Comparing text[2] ('A') with pattern[2] ('A')
#5Comparing text[3] ('B') with pattern[3] ('B')
#6Comparing text[4] ('D') with pattern[4] ('C')
#7Mismatch found at index 4. Shifting pattern.
#8Checking for match at index 1
#9Comparing text[1] ('B') with pattern[0] ('A')
#10Mismatch found at index 1. Shifting pattern.
#11Checking for match at index 2
#12Comparing text[2] ('A') with pattern[0] ('A')
#13Comparing text[3] ('B') with pattern[1] ('B')
#14Comparing text[4] ('D') with pattern[2] ('A')
#15Mismatch found at index 4. Shifting pattern.
#16Checking for match at index 3
#17Comparing text[3] ('B') with pattern[0] ('A')
#18Mismatch found at index 3. Shifting pattern.
#19Checking for match at index 4
#20Comparing text[4] ('D') with pattern[0] ('A')
#21Mismatch found at index 4. Shifting pattern.
#22Checking for match at index 5
#23Comparing text[5] ('A') with pattern[0] ('A')
#24Comparing text[6] ('B') with pattern[1] ('B')
#25Comparing text[7] ('A') with pattern[2] ('A')
#26Comparing text[8] ('C') with pattern[3] ('B')
#27Mismatch found at index 8. Shifting pattern.
#28Checking for match at index 6
#29Comparing text[6] ('B') with pattern[0] ('A')
#30Mismatch found at index 6. Shifting pattern.
#31Checking for match at index 7
#32Comparing text[7] ('A') with pattern[0] ('A')
#33Comparing text[8] ('C') with pattern[1] ('B')
#34Mismatch found at index 8. Shifting pattern.
#35Checking for match at index 8
#36Comparing text[8] ('C') with pattern[0] ('A')
#37Mismatch found at index 8. Shifting pattern.
#38Checking for match at index 9
#39Comparing text[9] ('D') with pattern[0] ('A')
#40Mismatch found at index 9. Shifting pattern.
#41Checking for match at index 10
#42Comparing text[10] ('A') with pattern[0] ('A')
#43Comparing text[11] ('B') with pattern[1] ('B')
#44Comparing text[12] ('A') with pattern[2] ('A')
#45Comparing text[13] ('B') with pattern[3] ('B')
#46Comparing text[14] ('C') with pattern[4] ('C')
#47Comparing text[15] ('A') with pattern[5] ('A')
#48Comparing text[16] ('B') with pattern[6] ('B')
#49Comparing text[17] ('A') with pattern[7] ('A')
#50Comparing text[18] ('B') with pattern[8] ('B')
Playback Speed
Execution State
STEP 1 / 51
i
Input Memory Buffer (T)
A
0
B
1
A
2
B
3
D
4
A
5
B
6
A
7
C
8
D
9
A
10
B
11
A
12
B
13
C
14
A
15
B
16
A
17
B
18
j
Pattern Pointer (P)
A
0
B
1
A
2
B
3
C
4
A
5
B
6
A
7
B
8
Checking for match at index 0

Local Step State

No specific auxiliary state for this algorithm.

Memory Inspection

0x41
0x42
0x41
0x42
0x44
0x41
0x42
0x41
0x43
0x44
0x41
0x42
0x41
0x42
0x43
0x41
0x42
0x41
0x42
Process Description

Checking for match at index 0