KMP Pattern Searching
Knuth-Morris-Pratt Pattern Searching 긴 문자열 \(A\)(길이 \(M\))에서 특정 패턴 문자열 \(B\)(길이 \(N\))가 나타나는 모든 위치를 \(O(M + N)\) 시간에 찾아내는 알고리즘이다. 구현#include using namespace std; // 문자열 A에서 문자열 B와 일치하는 위치를 모두 찾는다. vector KMPSearch(const string& A, const string& B) { int AN = A.length(), BN = B.length(); // 부분 일치 테이블 생성 vector pi(BN, 0); int matched = 0; for (int i = 1; i 0 && B[i] !..
알고리즘 이론
2017. 2. 20. 20:05
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- karatsuba
- kmp search
- Fenwick Tree
- divide and conquer
- Binary search
- suffix array
- constructive algorithms
- greedy
- sort
- parametric search
- sliding window
- search
- Heap
- math
- Data structure
- Strings
- Dynamic Programming
- pattern matching
- tree
- implementation
- Segment Tree
- BFS
- Minimum Spanning Tree
- branch and bound
- Square root decomposition
- Graph
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함