Skip to content

Instantly share code, notes, and snippets.

@yaboong
yaboong / CountingSort.java
Created March 20, 2018 10:26
Counting Sort
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};
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;
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();
@yaboong
yaboong / BubbleSort.java
Created February 18, 2018 20:08
Bubble Sort
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++) {
@yaboong
yaboong / SelectionSort.java
Created February 18, 2018 20:07
Selection Sort
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;
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--){
@yaboong
yaboong / merge.java
Last active February 18, 2018 19:39
Test.java
merge
merge
merge
merge
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) {
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){
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) {