Skip to content

Instantly share code, notes, and snippets.

View coderodde's full-sized avatar

Rodion Efremov coderodde

View GitHub Profile
@coderodde
coderodde / TimeDependentBayes.java
Last active September 30, 2026 05:45
TimeDependentBayes.java
package io.github.coderodde.math.prob.timebayes;
public final class TimeDependentBayesJava {
public static interface IntervalEvent {
public abstract double probability(double t);
}
public static final IntervalEvent EVENT_B =
@coderodde
coderodde / FastBigIntegerBinomial.java
Created August 28, 2026 09:50
Comparing different binomial computation implementations.
package io.github.coderodde.math;
import java.math.BigInteger;
/**
* This class provides some facilities for computing binomials with arbitrary
* precision.
*/
public final class FastBigIntegerBinomial {
@coderodde
coderodde / main.py
Last active August 9, 2026 12:43
CR.BFS1 for Python
from collections import deque
# The start cell in (0, 0) should be 1 for funniness:
m = [[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 0],
[0, 0, 1, 0, 0, 0],
@coderodde
coderodde / DualTextProgressBar.java
Last active July 7, 2026 11:48
DualTextProgressBar.java - a text UI for the progress bar in terminal enironments.
package io.github.coderodde.textui.components;
import java.io.IOException;
import org.jline.terminal.Terminal;
import org.jline.terminal.TerminalBuilder;
/**
* This class implements a simple text UI progress bar.
*/
public final class DualTextProgressBar {
@coderodde
coderodde / Test1.java
Last active May 1, 2026 07:43
CR.ComputeMean
import java.math.BigDecimal;
import java.util.*;
public class Test1 {
private static double computeMean1(double... values) {
double sum = 0.0;
for (double x : values) {
sum += x;
}
@coderodde
coderodde / good-arguments.txt
Last active April 26, 2026 15:59
Good WikiGameKiller.java arguments
java -jar target\WikiGameKiller.java-1.0.0.jar --source https://en.wikipedia.org/wiki/Audi --target https://en.wikipedia.org/wiki/Hiisi --expansion-timeout 5000000000 --forward-threads 512 --backward-threads 512 --master-trials 1000 --master-sleep-duration 50000000 --slave-sleep-duration 100000000 --stats --out ..\index.html
java -jar target\WikiGameKiller.java-1.0.0.jar --source https://en.wikipedia.org/wiki/Johnny_Depp --target https://en.wikipedia.org/wiki/Bugatti --expansion-timeout 10000000000 --forward-threads 512 --backward-threads 512 --master-trials 1000 --master-sleep-duration 50000000 --slave-sleep-duration 100000000 --stats --out ..\index.html
@coderodde
coderodde / main.py
Last active April 11, 2026 16:42
Code Review: (sorted) linked list to a BST.
import time
class ListNode():
def __init__(self, datum):
self.datum = datum
self.next = None
class LinkedList():
from collections import defaultdict
from typing import DefaultDict, Generic, Iterator, Optional, TypeVar
T = TypeVar("T")
class Node(Generic[T]):
__slots__ = ("data", "bottom")
def __init__(self, value : T, bottom: Optional["Node[T]"] = None) -> None:
@coderodde
coderodde / Fraction.java
Last active February 18, 2026 13:12
Ohejlma Todennököisyyslaskenta I 2026 kurssia varten: viikko 5 tehtävä 5.
package viikko5;
import java.util.Objects;
public final class Fraction implements Comparable<Fraction> {
public static final Fraction ZERO = new Fraction(0);
private final long numerator;
private final long denominator;
@coderodde
coderodde / Tehtavat4.java
Last active February 7, 2026 10:02
Todennakoisyyslaskenta I viikko 4 tehtava 1 koodi
package viikko4;
// https://github.com/coderodde/DiscreteRandomVariables.java
import io.github.coderodde.prob.randomvariables.support.BinomialDistribution;
import io.github.coderodde.prob.randomvariables.support.PoissonDistribution;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class Tehtavat4 {