Skip to content

Instantly share code, notes, and snippets.

View keehyun2's full-sized avatar
😪
zzzz

Keehyun Park keehyun2

😪
zzzz
View GitHub Profile
@keehyun2
keehyun2 / UTMK_TO_WGS84.html
Last active November 24, 2020 06:47
https://www.data.go.kr/ 에서 제공하는 utm-k 를 wgs84 로 변경하는 방법
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Road API</title>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.6.2/proj4.js" integrity="sha512-cgJnZ1VX2G0MAN4C5OGShwI3zHhfQ6RLriXuukhblNu+T082/ZRGoWLP/0xMKObvB6AUKdnm27hQKj8hKZPjXA==" crossorigin="anonymous"></script>
<script>
@keehyun2
keehyun2 / StringZip.java
Created February 7, 2020 07:20
문바열 압축 - 수행시간 개선... (다른코드 많이 참조했습니다)
public class StringZip {
public int solution(String s) {
//System.out.println(s);
int minLength = s.length();
for (int unit = 1; unit <= s.length() / 2; unit++) { // for #01
String composeStr = "";
int repeatCnt = 1;
String preStr = "";
String postStr = s;
package programers;
import java.util.HashMap;
import java.util.Map;
public class StringZip {
public int solution2(String s) {
int minResult = s.length();
for (int unit = 1; unit <= s.length() / 2; unit++) { // for #01
int resultLength = unit;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String n = sc.next();
char[] arrChar = n.toCharArray();
for (int i = 0; i < arrChar.length; i++) {
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <math.h>
using namespace std;
int main() {
int a[7] = {0,500,300,200,50,30,10};
@keehyun2
keehyun2 / BinarySearchTree.java
Created April 27, 2018 02:18
BinarySearchTree
public class BinarySearchTree {
public static Node root;
public BinarySearchTree() {
this.root = null;
}
/**
* tree 에서 key 로 node 를 탐색합니다.
* @param id
@keehyun2
keehyun2 / StringLengthComparator.java
Created January 28, 2018 04:11
Comparator 구현
import java.util.Comparator;
import java.util.PriorityQueue;
public class Test
{
public static void main(String[] args)
{
Comparator<String> comparator = new StringLengthComparator();
PriorityQueue<String> queue =
new PriorityQueue<String>(10, comparator);
@keehyun2
keehyun2 / CustomString.java
Created January 28, 2018 04:10
CustomString
class CustomString implements Comparable<CustomString> {
public String str;
public CustomString(String str) {
this.str = str;
}
public int compareTo(CustomString cs) {
int leng1 = this.str.length();
@keehyun2
keehyun2 / buildHeap.java
Created January 28, 2018 04:09
buildHeap
/**
* heapify 함수를 활용하여 Heap 을 구축합니다.
* @param arr
* @param nodeIndex
* @param heapSize
*/
void buildHeap(int[] arr, int nodeIndex, int heapSize) {
if(nodeIndex >= heapSize/2) return;
buildHeap(arr, 2 * nodeIndex + 1, heapSize); // buildHeap- left subTree
buildHeap(arr, 2 * nodeIndex + 2, heapSize); // buildHeap- right subTree
@keehyun2
keehyun2 / heapify.java
Created January 28, 2018 04:09
heapify
/**
* node의 childe node를 비교하여 히프화합니다.
* @param arr
* @param nodeIndex 히프화할 node 의 번호입니다.
* @param heapSize 완전 이진 트리의 크기입니다.
*/
void heapify(int[] arr, int nodeIndex, int heapSize) {
int ai = arr[nodeIndex];
while (nodeIndex < heapSize/2) { // arr[i] 는 leaf 가 아닌경우만 loop 를 순환합니다.
int j = 2 * nodeIndex + 1; // j는 ai의 좌측 자식 노드의 index 입니다.