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.io.Closeable; | |
import org.junit.Rule; | |
import org.junit.Test; | |
import org.junit.runner.Description; | |
import org.slf4j.Logger; | |
import org.testcontainers.containers.GenericContainer; | |
import com.github.dockerjava.api.command.InspectContainerResponse; | |
import com.github.dockerjava.api.model.Frame; |
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 eu.devclub; | |
import java.util.*; | |
public class NatNumSequence { | |
public static int getNthDigit(long index) { | |
if(index < 1) throw new IllegalArgumentException( "Not a natural number" ); | |
if(index < 10 ) return (int) index; | |
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 org.coursera.algo; | |
import java.util.*; | |
public abstract class Graph<V extends AbstractVertex<E>, E extends AbstractEdge<V>> { | |
private final TreeMap<Integer, V> vertices = new TreeMap<Integer, V>( | |
new Comparator<Integer>() { | |
//for pretty printing | |
@Override |
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.io.*; | |
import java.util.*; | |
/** | |
* https://class.coursera.org/algo/quiz/attempt?quiz_id=52 | |
*/ | |
public class MinCut { | |
private static class Graph { | |
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
public class QuickSort { | |
private interface PivotStrategy { | |
public void selectPivot(int[] a, int p, int r); | |
} | |
private final static PivotStrategy PIVOT_ON_FIRST = new PivotStrategy() { | |
@Override | |
public void selectPivot(int[] a, int p, int r) { | |
//do nothing |
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
--module AlgoClass where | |
import Data.List (elem, permutations) | |
import System.IO | |
import System.CPUTime | |
--Week 1 | |
--Merge Sort | |
mergesort :: Ord a => [a] -> [a] |