Skip to content

Instantly share code, notes, and snippets.

View cbruegg's full-sized avatar

Christian Brüggemann cbruegg

View GitHub Profile
public static final double EPSILON = 0.00001;
public static double nullstelle2(double ug, double og) {
while (og - ug >= EPSILON) {
double ugErsteHaelfte = ug;
double ogErsteHaelfte = ug + (og - ug) / 2;
double ugZweiteHaelfte = ogErsteHaelfte;
double ogZweiteHaelfte = og;
if (Math.sin(ugErsteHaelfte) * Math.sin(ogErsteHaelfte) <= 0) {
val numberOfBSTs = hashMapOf(
0 to 1.0,
1 to 1.0,
2 to 2.0
)
fun numberOfBSTs(nodes: Int): Double =
when (nodes) {
in numberOfBSTs -> numberOfBSTs[nodes]!!
else -> ((1..nodes)
# Config
learningRate <- 0.000001 # alpha
maxIterations <- 10000000 # abort after n iterations
maxThetaDifference <- 0.000001 # assume t in theta is close enough if diff after iter < than this
data <- read.csv("data1.tsv", sep = "\t", header = FALSE)
hypothesis <- function(theta, x){
return(theta[1] + theta[2] * x)
}
dependencies {
// Data Binding
kapt 'com.android.databinding:compiler:2.1.2'
}
package a
val pattern = "aba"
val text = "ababa".repeat(100000)
val runs = 1000
fun occTest(): Long {
// Warmup
repeat(10) {
text.occurrencesOf(pattern, ignoreCase = false, matchOverlapping = true).forEach { }
val pattern = "abababababa"
val text = "abababa".repeat(1000)
val runs = 50
fun occTest(): Long {
// Warmup
repeat(5) {
text.occurrencesOf(pattern, ignoreCase = false, matchOverlapping = true).forEach { }
}
library(igraph)
gamma = 0.7
edge_list = as.matrix(read.csv('ueb06-daten.csv'))
graph = graph_from_edgelist(edge_list, directed = FALSE)
print("Loaded graph.")
find_clique_component <- function() {
components = decompose.graph(graph)
class A()
class B<T>()
fun <T> A.f(b: B<T>) {
val eq = this == b // Error: Operator '==' cannot be applied to 'A' and 'B<T>'
}
class A2<T>()
class B2<T>()
package chess;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
class Graph {
final Set<Node> nodes;
final Set<Edge> edges;
Iteration 149
HashSkipNode{skipNode=SkipNode{running=true, id=2, bitstring='001000', neighbors=0:{[7, 10]}1:{[]}2:{[]}3:{[]}4:{[]}5:{[]}, internalMap={2=3, 4=5, 6=20}}
HashSkipNode{skipNode=SkipNode{running=true, id=7, bitstring='111010', neighbors=0:{[2, 10, 20]}1:{[10]}2:{[10]}3:{[]}4:{[]}5:{[]}, internalMap={8=4}}
HashSkipNode{skipNode=SkipNode{running=true, id=10, bitstring='110011', neighbors=0:{[2, 7]}1:{[7]}2:{[7]}3:{[]}4:{[]}5:{[]}, internalMap={1=2}}
HashSkipNode{skipNode=SkipNode{running=false, id=20, bitstring='001101', neighbors=0:{[2, 10]}1:{[2]}2:{[2]}3:{[2]}4:{[]}5:{[]}, internalMap={1=2}}
-----------------------------
Iteration 150
TEST: Join node 25 at node 2
HashSkipNode{skipNode=SkipNode{running=true, id=2, bitstring='001000', neighbors=0:{[7, 10]}1:{[]}2:{[]}3:{[]}4:{[]}5:{[]}, internalMap={2=3, 4=5, 6=20}}
HashSkipNode{skipNode=SkipNode{running=true, id=7, bitstring='111010', neighbors=0:{[2, 10, 20]}1:{[10]}2:{[10]}3:{[]}4:{[]}5:{[]}, internalMap={8=4}}