File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Algorithms/Strings/PatternMatching Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Algorithms . Strings . PatternMatching ;
4
4
5
+ /// <summary>
6
+ /// Implentation of regular expression matching with support for '.' and '*'.
7
+ /// '.' Matches any single character.
8
+ /// '*' Matches zero or more of the preceding element.
9
+ /// The matching should cover the entire input string (not partial).
10
+ /// </summary>
5
11
public static class WildCardMatcher
6
12
{
13
+ /// <summary>
14
+ /// Using bottom-up dynamic programming for matching the input string with the pattern.
15
+ ///
16
+ /// Time complexity: O(n*m), where n is the length of the input string and m is the length of the pattern.
17
+ ///
18
+ /// Constrain: The pattern cannot start with '*'.
19
+ /// </summary>
20
+ /// <param name="inputString">The input string to match.</param>
21
+ /// <param name="pattern">The pattern to match.</param>
22
+ /// <returns>True if the input string matches the pattern, false otherwise.</returns>
23
+ /// <exception cref="ArgumentException">Thrown when the pattern starts with '*'.</exception>
7
24
public static bool MatchPattern ( string inputString , string pattern )
8
25
{
9
26
if ( pattern . Length > 0 && pattern [ 0 ] == '*' )
You can’t perform that action at this time.
0 commit comments