Skip to content

Instantly share code, notes, and snippets.

View fpdjsns's full-sized avatar
😄
인생의 풍류를 즐기는 중

withham fpdjsns

😄
인생의 풍류를 즐기는 중
View GitHub Profile
@fpdjsns
fpdjsns / c++_stl_vector.cc
Last active March 14, 2017 16:46
How to use vector and what effect it is.
#include<iostream>
#include<vector>
using namespace std;
//벡터 출력
void print(vector<int> v)
{
if (v.empty())//empty
{
@fpdjsns
fpdjsns / Merge_Sort.cc
Created March 25, 2017 16:57
병합 정렬(Merge Sort)
#include<iostream>
#include<algorithm>
#define SIZE 1000
using namespace std;
void Merge(int arr[], int l, int r)
{
int temp[SIZE];
int mid = (l + r) / 2;
int i = l;
//최대 힙(max heap)
#include<iostream>
#include<vector>
using namespace std;
void swap(int& a, int& b);
void insertnode(vector<int>& heap, int data); //추가
int deletenode(vector<int>& heap); //삭제
#include<iostream>
#include<string>
#include<algorithm>
#define MAX 1001
#define ADD 'a'
#define DEL 'd'
#define MOD 'm'
#define COPY 'c'
@fpdjsns
fpdjsns / 외판원순회(TSP).cc
Created May 1, 2017 13:46
외판원순회(TSP : Traveling Salesperson Problem)
#include<iostream>
#define MAX 17000000
#define CITY 16
using namespace std;
int n;
int arr[CITY][CITY];
int d[1 << CITY][CITY] = { 0 };
#include<iostream>
using namespace std;
void SWAP(int arr[], int a, int b)
{
int temp = arr[a];
arr[a] = arr[b];
arr[b] = temp;
}
@fpdjsns
fpdjsns / 힙 정렬(Heap sort. 우선순위 큐).cc
Last active July 11, 2017 05:24
우선순위 큐를 이용
#include<iostream>
#include<queue>
using namespace std;
int main()
{
priority_queue<int> max_heap;
int n, temp;
cin >> n;
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int solve()
{
int n;
cin >> n;
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
int T;
cin >> T;
for (int testcase = 1; testcase <= T; testcase++)
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
pair<unsigned long long int, unsigned long long int> ans;//최소, 최대
int k;