From 174eb498654c85e8de457e09e237074f195a3e40 Mon Sep 17 00:00:00 2001 From: priya Date: Sun, 18 Oct 2020 16:02:40 +0530 Subject: [PATCH 1/2] added wild to Algorithms --- Wildcardmatching/README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Wildcardmatching/README.md diff --git a/Wildcardmatching/README.md b/Wildcardmatching/README.md new file mode 100644 index 0000000..a011d33 --- /dev/null +++ b/Wildcardmatching/README.md @@ -0,0 +1,34 @@ +# Readme + +***Wild card matching using Dynamic Programming*** + +This is a dynamic programing approach to match the given string with a given pattern. + +The pattern can be empty and can contain only lowercase letters a-z, and characters like ? or *. +The string can be empty and can contain only lowercase letters a-z. + +'?' Matches any single character. +'*' Matches any sequence of characters (including the empty sequence). + +The matching will cover the entire input string (not partial). + +***Example 1:*** + +```Input:``` +s = "aa" +p = "a" + +```Output:``` aa doesn't match with the given pattern: a? + +```Explanation:``` "a" does not match the entire string "aa". + +***Example 2:*** + +```Input:``` +s = "aa" +p = "*" + +```Output:``` aa matches the pattern: *? + +```Explanation:``` '*' matches any sequence. + From 755d83892df4f815b026fbed339973da87d9d6ca Mon Sep 17 00:00:00 2001 From: priya Date: Sun, 18 Oct 2020 16:05:43 +0530 Subject: [PATCH 2/2] added wildcard to Algorithms --- Wildcardmatching/input.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Wildcardmatching/input.txt diff --git a/Wildcardmatching/input.txt b/Wildcardmatching/input.txt new file mode 100644 index 0000000..6cf9f77 --- /dev/null +++ b/Wildcardmatching/input.txt @@ -0,0 +1,23 @@ +Enter a pattern: a*b? +Enter a string (enter q to quit): +abcdefbh +abcdefbh matches the pattern: a*b? + +Enter a string (enter q to quit): +abf +abf matches the pattern: a*b? + +Enter a string (enter q to quit): +acdb +acdb doesn't match with the given pattern: a*b? + +Enter a string (enter q to quit): +ab +ab doesn't match with the given pattern: a*b? + +Enter a string (enter q to quit): +abfbfbfbf +abfbfbfbf matches the pattern: a*b? + +Enter a string (enter q to quit): +q