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 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) { |
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
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) |
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
# 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) | |
} |
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
dependencies { | |
// Data Binding | |
kapt 'com.android.databinding:compiler:2.1.2' | |
} |
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 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 { } |
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
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 { } | |
} |
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
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) |
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
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>() |
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 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; |
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
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}} |
OlderNewer