Skip to content

Commit 39fc55a

Browse files
Add documentation to the class
1 parent a2e05c9 commit 39fc55a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Algorithms/Strings/PatternMatching/WildCardMatcher.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,25 @@
22

33
namespace Algorithms.Strings.PatternMatching;
44

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>
511
public static class WildCardMatcher
612
{
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>
724
public static bool MatchPattern(string inputString, string pattern)
825
{
926
if (pattern.Length > 0 && pattern[0] == '*')

0 commit comments

Comments
 (0)