ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
StringMatching.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*------------------------- File StringMatching.h --------------------------*/
3/*--------------------------------------------------------------------------*/
89/*--------------------------------------------------------------------------*/
90/*----------------------------- DEFINITIONS --------------------------------*/
91/*--------------------------------------------------------------------------*/
92
93#ifndef __ADS_StringMatching
94 #define __ADS_StringMatching
95/* self-identification: #endif constant */
96
97/*--------------------------------------------------------------------------*/
98/*------------------------------ INCLUDES ----------------------------------*/
99/*--------------------------------------------------------------------------*/
100
101#include <cstddef>
102#include <cstdint>
103#include "ADS/Contract.h"
104
105#include <string_view>
106#include <vector>
107
108/*--------------------------------------------------------------------------*/
109/*--------------------------- NAMESPACE ------------------------------------*/
110/*--------------------------------------------------------------------------*/
111
112namespace ADS
113{
114
129inline std::vector< std::size_t > naiveMatching( std::string_view T ,
130 std::string_view P );
131
150inline std::vector< long > failure( std::string_view P );
151
174inline std::vector< std::size_t > kmp( std::string_view T ,
175 std::string_view P ,
176 long * comparisons = nullptr );
177
195inline std::vector< long > strongFailure( std::string_view P );
196
210inline std::vector< std::size_t > kmpStrong( std::string_view T ,
211 std::string_view P ,
212 long * comparisons = nullptr );
213
240inline std::vector< std::size_t > boyerMoore( std::string_view T ,
241 std::string_view P ,
242 long * comparisons = nullptr );
243
265inline std::vector< std::size_t > horspool( std::string_view T ,
266 std::string_view P ,
267 long * comparisons = nullptr );
268
291inline std::vector< std::size_t > shiftOr( std::string_view T ,
292 std::string_view P );
293
317inline std::vector< std::size_t > zFunction( std::string_view S );
318
342inline std::vector< std::size_t > zMatching( std::string_view T ,
343 std::string_view P );
344
381inline std::vector< std::size_t > twoWay( std::string_view T ,
382 std::string_view P );
383
384/*--------------------------------------------------------------------------*/
385
386} // end( namespace ADS )
387
388/*--------------------------------------------------------------------------*/
389/*-------------------------- IMPLEMENTATION --------------------------------*/
390/*--------------------------------------------------------------------------*/
391
392#include "ADS/string/impl/StringMatching.tpp"
393
394/*--------------------------------------------------------------------------*/
395
396#endif /* StringMatching.h included */
397
398/*--------------------------------------------------------------------------*/
399/*----------------------- End File StringMatching.h ------------------------*/
400/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
std::vector< std::size_t > kmp(std::string_view T, std::string_view P, long *comparisons=nullptr)
the places of all the occurrences of in , by Knuth-Morris-Pratt; the comparisons of characters go to...
std::vector< std::size_t > zFunction(std::string_view S)
the Z-function: is the length of the longest common prefix of and , and
std::vector< std::size_t > shiftOr(std::string_view T, std::string_view P)
the places of all the occurrences of in , by Shift-Or
std::vector< std::size_t > horspool(std::string_view T, std::string_view P, long *comparisons=nullptr)
the places of all the occurrences of in , by Horspool
std::vector< long > strongFailure(std::string_view P)
the strong failure function: unless , in which case ;
std::vector< std::size_t > twoWay(std::string_view T, std::string_view P)
the places of all the occurrences of in , by the Two-Way algorithm of Crochemore and Perrin
std::vector< std::size_t > naiveMatching(std::string_view T, std::string_view P)
the places of all the occurrences of in , by trying every shift
std::vector< std::size_t > kmpStrong(std::string_view T, std::string_view P, long *comparisons=nullptr)
the occurrences of kmp() above, with the strong failure function on a mismatch
std::vector< long > failure(std::string_view P)
the failure function: is the length of the longest proper border of , and
std::vector< std::size_t > zMatching(std::string_view T, std::string_view P)
the places of all the occurrences of in , by the Z-function of and the Z-boxes of
std::vector< std::size_t > boyerMoore(std::string_view T, std::string_view P, long *comparisons=nullptr)
the places of all the occurrences of in , by Boyer-Moore with the bad character and the strong good ...
Definition ADT.h:96