자바스크립트에서 파일의 인코딩타입을 알아내는 방법을 알아보고자 한다. file마다 고유한 인코딩 타입을 가지고 있는데 type이 file인 input에서 파일을 선택했을 때 javascript로 파일의 정보를 읽어오고 해당 파일이 어떤 인코딩 방식으로 되어있는지 알아내고자 했다. javascript 라이브러리가 있어 이를 사용했다. 1. 스크립트에 encoding.js를 추가시킨다. 2. 타입이 file인 input을 만든다. 3. 스크립트에 파일이 선택되었을 때 호출되는 함수를 선언한다. 파일 인풋이 change되었을 때 작동하는 이벤트리스너를 통해 onFileSelect함수가 실행되도록 하면 이벤트를 통해 file의 정보를 가져오고 Encoding.detect를 통해 파일의 인코딩 방식을 가져올 수 ..
원더랜드(Kruskal MST 알고리즘: Union&Find 활용) #include #include #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; int unf[1001]; struct Edge{ int v1; int v2; int val; Edge(int a, int b, int c){ v1=a; v2=b; val=c; } bool operator
이항계수(메모이제이션) #include #include #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; int dy[21][21]; int DFS(int n, int r){ if(dy[n][r]>0) return dy[n][r]; if(n==r || r==0) return 1; else return dy[n][r]=DFS(n-1, r-1)+DFS(n-1, r); } int main() { //freopen("input.txt", "rt", stdin); int n, m; scanf("%d %d", &n, ..
최대수입 스케줄 #include #include #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; struct Data { int money; int when; Data(int a, int b){ money=a; when=b; } bool operatorb.when; } }; int main() { freopen("input.txt", "rt", stdin); int a, b, i, j, n, res=0, max=-2147000000; priority_queue pQ; vector T; scanf("%d",..
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/ejMRMV/btqTtpOccoJ/aflaFIujjY6IVlnfCm9HAK/img.png)
최대힙 최대힙은 완전이진트리로 구현된 자료구조이며 구성은 부모의 노드값이 왼쪽과 오른쪽 자식의 노드 값보다 크게 트리를 구성하는 것을 말한다. 이렇게 하는 트리의 루트노드는 입력된 값들 중 가장 큰 값이 저장되어 있다. 만약 1,2,3,4,5,6,7이 값으로 입력되면 트리는 아래와 같이 구성된다. 최대힙 예제코드 #include #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; int main() { //freopen("input.txt", "rt", stdin); int a; priority_queue p..
송아지 찾기 내가짠 코드 #include #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; int ch[10000], dis[10000]; int val[] = {1, -1, 5}; int main() { //freopen("input.txt", "rt", stdin); int n, m, i, a, b, x, res, min=2147000000; vector map[10000]; queue Q; scanf("%d %d", &n, &m); Q.push(n); ch[n]=1; while(!Q.empty()){ ..
이진트리 넓이우선탐색(BFS) #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; int Q[100], front=-1, back=-1, ch[10]; vector map[10]; int main() { freopen("input.txt", "rt", stdin); int i, a, b, x; for(i=1; i
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/bvheEM/btqS9YCK9kS/cWHM8Pz5gEjftosOMlFeS0/img.png)
DFS를 이용해 가중치 방향 그래프가 주어진 것을 보고 N번 정점으로 가는 최소 비용을 출력하는 프로그램을 작성하는 문제이다. 내가 작성한 코드(오답) #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; int map[30][30], n, m, ch[30], sum, min_val=214700000; void DFS(int v){ int i; if(v==n){ printf("sum: %d\n", sum); if(sum
- Total
- Today
- Yesterday
- BFS
- 최단경로
- 스텍
- C++
- stackframe
- C
- dfs
- 동적프로그래밍
- 퀵정렬
- 이진탐색
- 클래스
- Stack
- 인접리스트
- 자료구조
- 배열
- 알고리즘
- 운영체제
- Java
- server side rendering
- react
- 구조체
- client side rendering
- 병행프로세스
- 세마포어
- javascript
- 소프트웨어
- 인접행렬
- 교착상태
- 입출력장치
- 재귀함수
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |