Skip to content

Instantly share code, notes, and snippets.

View coderodde's full-sized avatar

Rodion Efremov coderodde

View GitHub Profile
@coderodde
coderodde / CodeWord.java
Last active November 13, 2025 08:53
The Huffman encoder in Java.
package io.github.coderodde.compression;
import java.util.BitSet;
/**
* This class implements a <b>binary</b> code word in data compression
* scenarios.
*
* @author Rodion "rodde" Efremov
* @version 1.0.0 (Oct 28, 2025)
@coderodde
coderodde / CodeWord.java
Last active October 28, 2025 12:25
Data Compression Techniques 2025 - Week 1 Task 6 (Shannon-Fano coding)
package io.github.coderodde.compression;
import java.util.BitSet;
/**
* This class implements a <b>binary</b> code word in data compression
* scenarios.
*
* @author Rodion "rodde" Efremov
* @version 1.0.0 (Oct 28, 2025)
@coderodde
coderodde / main.c
Created October 12, 2025 15:13
Splitting a linked list into odd and even sublists.
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct list_node_t {
int datum;
struct list_node_t* next;
} list_node_t;
typedef struct list_t {
@coderodde
coderodde / index.html
Last active September 20, 2025 07:02
Generating string permutations in Javascript.
<!DOCTYPE html>
<html>
<head>
<title>Letter permutations</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<script>
const str = "ABCDEFGH";
@coderodde
coderodde / RotationalEnergies.java
Created July 14, 2025 09:27
A Java program generating the a_n values for rotational energies.
package io.github.coderodde.physics.mechanics.rotation;
import java.math.BigInteger;
/**
* This class computes some rotational energies of {@code n}-dimensional, solid,
* equidense balls.
*
* @version 1.1.0 (Jul 14, 2025)
* @since 1.0.0 (Jul 13, 2025)
@coderodde
coderodde / NdimensionalBallVolumes.java
Last active July 13, 2025 09:35
A small Java program for computing volumes of n-dimensional balls.
package io.github.coderodde.math.simulation.volumes;
public class NdimensionalBallVolumes {
private static final int LARGEST_DIMENSION = 50;
public static void main(String[] args) {
final Volume[] volumes = generateVolumes(LARGEST_DIMENSION);
final int maxVolumeExpressionLength =
getMaximumVolumeExpressionLength(volumes);
#include <Windows.h>
#include <sstream>
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
PSTR lpCmdLine,
int nCmdShow) {
UNREFERENCED_PARAMETER(hInstance);
UNREFERENCED_PARAMETER(hPrevInstance);
@coderodde
coderodde / main.cpp
Last active November 13, 2024 07:51
A C++ program for counting byte histograms in files.
#include <algorithm>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <ios>
#include <istream>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
@coderodde
coderodde / com.github.coderodde.math.BigInteger.java
Last active October 31, 2024 07:49
A simple class for holding non-negative integers with arbitrary number of digits. Supports only summation operation.
package com.github.coderodde.math;
import java.util.Objects;
import java.util.Random;
import java.util.Scanner;
/**
* This class represents a non-negative integer with arbitrary number of digits.
* Instances of this class are immutable.
*
@coderodde
coderodde / indexed.linked.list.entropy.dat
Last active October 30, 2024 14:13
The output of the IndexedLinkedListEntropy program.
# Iteration: 1
0.019900 3168.985000
0.029800 2662.328200
0.039700 2448.982600
0.049600 3247.529200
0.059500 3473.904600
0.069400 3333.155200
0.079300 2165.653900
0.089200 2179.825000
0.099100 2116.665100