This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.Collections; | |
/** | |
* Created by yaboong on 2018. 3. 20.. | |
*/ | |
public class CountingSort { | |
public static void main(String[] args) { | |
Integer[] a = {1, 0, 3, 1, 3, 1}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class TwoByNTiling11726 { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
int N = sc.nextInt(); | |
long d[] = new long[N+1]; | |
d[0] = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
/** | |
* Created by yaboong on 2018. 2. 26.. | |
*/ | |
public class ToOne { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
int N = sc.nextInt(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
/** | |
* Created by yaboong on 2018. 2. 14.. | |
*/ | |
public class BubbleSort { | |
public static void bubbleSort(int[] arr) { | |
int temp = 0; | |
for(int i = 0; i < arr.length; i++) { | |
for(int j= 1 ; j < arr.length-i; j++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
/** | |
* Created by yaboong on 2018. 1. 15.. | |
*/ | |
public class SelectionSort { | |
public static void selectionSort(Comparable[] arr){ | |
int N = arr.length; | |
for (int i = 0; i < N; i++){ | |
int min = i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
/** | |
* Created by yaboong on 2018. 1. 15.. | |
*/ | |
public class InsertionSort { | |
public static void insertionSort(Comparable[] arr){ | |
int N = arr.length; | |
for(int i = 0; i < N; i++){ | |
for(int j = i; j > 0; j--){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
merge | |
merge | |
merge | |
merge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.LinkedList; | |
/** | |
* Created by yaboong on 2018. 2. 19.. | |
*/ | |
public class Graph { | |
private final int V; | |
private LinkedList<Integer>[] adj; | |
public Graph(int V) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package cc.yaboong.algorithms.sort; | |
import java.util.Arrays; | |
/** | |
* Created by yaboong on 2018. 2. 14.. | |
*/ | |
public class MergeSort { | |
// 병합하면서 정렬한다 | |
private static void merge(Comparable[] a, Comparable[] aux, int lo, int mid, int hi){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package cc.yaboong.algorithms.sort; | |
import java.util.Arrays; | |
import java.util.Collections; | |
/** | |
* Created by yaboong on 2018. 2. 18.. | |
*/ | |
public class QuickSort { | |
public static void sort(Comparable[] a) { |