TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Implementation of the Wildcard Matching problem. More...
#include <cassert>
#include <cstdint>
#include <iostream>
#include <vector>
Go to the source code of this file.
Namespaces | |
namespace | backtracking |
for vector container | |
namespace | wildcard_matching |
Functions for the Wildcard Matching problem. | |
Functions | |
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. | |
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. | |
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
Definition in file wildcard_matching.cpp.
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.
s | is the given matching string |
p | is the given pattern |
pos1 | is the starting index |
pos2 | is the last index |
int main | ( | void | ) |
Main function.
Definition at line 153 of file wildcard_matching.cpp.
|
static |
Self-test implementations.
Definition at line 102 of file wildcard_matching.cpp.
bool backtracking::wildcard_matching::wildcard_matching | ( | std::string | s, |
std::string | p, | ||
uint32_t | pos1, | ||
uint32_t | pos2 ) |
Definition at line 40 of file wildcard_matching.cpp.