About
PS study.
Table of Contents
탐색(Searching)
BFS
Source code
기본적인 너비 우선 탐색을 큐 자료구조를 활용해 구현.
DFS
Source code
기본적인 깊이 우선 탐색을 재귀적으로 구현.
이분 탐색(Binary Search)
Source code
데이터가 정렬 되어있다면 O(log N) 복잡도로 검색할 수 있음.
수학(Math)
확장 유클리드 호제법(EGCD)
Source code
확장 유클리드 호제법을 재귀적으로 구현.
고속 지수 계산(Fast exponent)
Source code
지수 법칙을 활용하면 a^p mod p를 O(log N) 복잡도로 구할 수 있음.
순열(Permutation)
Source code
next_permutation()을 활용하여 벡터의 모든 순열을 구할 수 있음.
행렬의 곱셈(Matrix multiplication)
Source code
2차원 vector를 활용한 행렬의 곱셈.
행렬의 거듭제곱(Matrix Exponentiation)
Source code
2차원 vector, 분할 정복을 활용한 행렬의 거듭제곱 계산.
디오판토스 방정식(Diophantine equation)
Source code
디오판토스 방정식의 일반해 구현.
자료구조(Data structure)
Set
Source code
두개의 Set 자료구조의 합집합을 구하는 예제.
Priority Queue
Source code
pair의 second에 대한 우선순위 큐(최소 힙) 예제
문자열(String)
공백단위로 자르기(Spliting strings by spaces)
Source code
stringstream을 활용하여 문자열을 공백단위로 자르는 예제.
특정 문자로 자르기(Spliting strings by delimiter)
Source code
getline() 과 stringstream을 활용하여 문자열을 특정 구분자로 자를 수 있음.