Skip to content

Instantly share code, notes, and snippets.

View JoeUnsung's full-sized avatar
🏠
Working from home

Joe JoeUnsung

🏠
Working from home
  • SSG.COM
  • Seoul
View GitHub Profile
@JoeUnsung
JoeUnsung / Bottom_up_merge_sort_InC
Last active April 13, 2017 08:46
Bottom up merge sort in C language
#include <stdio.h>
#include <stdlib.h>
int *A; // 받아온 숫자를 저장하기 위한 배열을 전역변수로 선언합니다.
int *B; // 임시저장을 위한 배열을 전역변수로 선언합니다. 추후 동적할당을 통해 활용.
void Merge(int low, int mid, int high); // bottom up merge를 위한 소트
int main(void) {
int n = 0; // 수의 갯수
@JoeUnsung
JoeUnsung / depthFirstSearchWheatKindAndNum
Created December 19, 2016 16:50
Find the number of wheat and amount of each of wheat out by the depth first search algorithm.
package joe;
import java.util.*;
import java.lang.*;
class dfSearch{
int wheat = 1;
int cnt = 0;
int map[][];
@JoeUnsung
JoeUnsung / completeNum
Created December 17, 2016 17:57
Check the number whether complete number or not.
import java.util.*;
import java.io.*;
class Main {
public static int checkCompleteNum(int num){
// 숫자가 완전제곱수인지를 체크하는 메서드 작성.
for(int i = 0 ; i < num ; i++){
if ( num == i*i ){
@JoeUnsung
JoeUnsung / avgCnt
Created December 17, 2016 17:56
calculate average
import java.util.*;
import java.text.*;
class Main {
public static double avgCnt(int[] list, int cnt){
double sum = 0;
for(int i = 0 ; i < cnt ; i++){
sum += (double)list[i];
}
@JoeUnsung
JoeUnsung / stringMystery
Last active December 17, 2016 17:56
Making string as a secret mode
import java.util.*;
import java.lang.*;
class Main {
public static String reverseString(String s) {
return ( new StringBuffer(s) ).reverse().toString();
}
public static void main(String[] args) {
@JoeUnsung
JoeUnsung / EX2
Created December 8, 2016 16:42
Testcode #2 ; Find out what row and line will make most "1" in the matrix when it is reversed.
package joe;
public class E2_20101062 {
public static void main(String[] args){
int N=8, M=5;
int[][] map = {{1,0,1,1,0},
{0,0,1,0,0},
{1,0,0,0,1},
@JoeUnsung
JoeUnsung / EX1
Created December 8, 2016 16:41
Testcode #1
package joe;
import java.lang.*;
import java.util.*;
public class E1_20101062 {
public static void main(String[] args){
String[] color = {"red", "green", "blue", "white", "black", "yellow", "pink", "grey"};
Queue myQue = new LinkedList();
Stack myStack = new Stack();
@JoeUnsung
JoeUnsung / includeChar
Created December 7, 2016 03:20
Check the number of including specific string in another string.
package joe;
import java.lang.*;
import java.util.*;
import java.io.*;
public class HW3_PRAC {
public static int count(String src, String target){
char temp1, temp2;
package joe;
import java.lang.*;
import java.util.*;
class Connection {
private String departure;
private String arrival;
@JoeUnsung
JoeUnsung / newHangManGame
Created November 26, 2016 16:01
Play hangman. Enjoy.
package joe;
import java.util.*;
public class P8_20101062_1 {
public static void main(String[] args){
Random r = new Random();