Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Implementation of the Wildcard Matching problem. More...
#include <cassert>
#include <iostream>
#include <vector>
Namespaces | |
namespace | backtracking |
for vector container | |
namespace | wildcard_matching |
Functions for the Wildcard Matching problem. | |
Functions | |
bool | backtracking::wildcard_matching::wildcard_matching (std::string s, std::string p, uint32_t pos1, uint32_t pos2) |
static void | test () |
Self-test implementations. | |
int | main () |
Main function. | |
Variables | |
std::vector< std::vector< int64_t > > | backtracking::wildcard_matching::dpTable (1000, std::vector< int64_t >(1000, -1)) |
The main function implements if pattern can be matched with given string. | |
Implementation of the Wildcard Matching problem.
Given a matching string and a pattern, implement wildcard pattern matching with support for ?
and *
. ?
matches any single character. *
matches any sequence of characters (including the empty sequence). The matching should cover the entire matching string (not partial). The task is to determine if the pattern matches with the matching string
int main | ( | void | ) |
|
static |
Self-test implementations.
bool backtracking::wildcard_matching::wildcard_matching | ( | std::string | s, |
std::string | p, | ||
uint32_t | pos1, | ||
uint32_t | pos2 ) |
std::vector< std::vector< int64_t > > backtracking::wildcard_matching::dpTable(1000, std::vector< int64_t >(1000, -1)) | ( | 1000 | , |
std::vector< int64_t > | 1000, -1 ) |
The main function implements if pattern can be matched with given string.
s | is the given matching string |
p | is the given pattern |
pos1 | is the starting index |
pos2 | is the last index |