Skip to content

Instantly share code, notes, and snippets.

View coderodde's full-sized avatar

Rodion Efremov coderodde

View GitHub Profile
@coderodde
coderodde / SO.dat
Created September 6, 2022 06:31
The gnuplot data file for a SO question.
100000 14025
200000 31589
300000 48934
400000 79414
500000 97281
600000 105605
700000 131557
800000 148332
900000 172268
1000000 209032
@coderodde
coderodde / EntropyToAmortizedWork.dat
Last active March 16, 2023 06:05
Entropy to work ratio
0.02980 3224
0.03970 2354
0.06940 2340
0.07930 3074
0.08920 3525
0.09910 2074
0.11890 3494
0.12880 3266
0.13870 2216
0.16840 2908
@coderodde
coderodde / IndexedLinkedListEntropy.java
Last active May 11, 2023 05:21
Researching the entropy of the IndexedLinkedList.
package com.github.coderodde;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class IndexedLinkedListEntropy {
private static final int NUMBER_OF_RUNS = 100;
private static final int NUMBER_OF_DATA_POINTS_TO_FETCH = 50;
@coderodde
coderodde / RawDataSimple.txt
Created August 19, 2022 12:59
Raw simple IndexedLinkedList benchmark data
arrayListAddAtBeginning: 200365
arrayListAddAtBeginning: 688106
arrayListAddAtBeginning: 1399857
arrayListAddAtBeginning: 2509827
arrayListAddAtBeginning: 4786943
arrayListAddAtEnd: 8171
arrayListAddAtEnd: 14536
arrayListAddAtEnd: 21223
arrayListAddAtEnd: 27780
arrayListAddAtEnd: 37979
package com.github.coderodde.illbenchmarkconverter;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
IndexedLinkedListPerformance2.arrayListAddAtBeginning 1 10 avgt 5 263,456 ± 29,008 ns/op
IndexedLinkedListPerformance2.arrayListAddAtBeginning 1 100 avgt 5 3596,768 ± 824,369 ns/op
IndexedLinkedListPerformance2.arrayListAddAtBeginning 1 1000 avgt 5 142000,031 ± 148744,422 ns/op
IndexedLinkedListPerformance2.arrayListAddAtBeginning 1 10000 avgt 5 6582235,325 ± 3083861,848 ns/op
IndexedLinkedListPerformance2.arrayListAddAtEnd 1 10 avgt 5 48,519 ± 17,718 ns/op
IndexedLinkedListPerformance2.arrayListAddAtEnd 1 100 avgt 5 864,662 ± 923,860 ns/op
IndexedLinkedListPerformance2.arrayListAddAtEnd 1 1000 avgt 5 8136,263 ± 7139,201 ns/op
IndexedLinkedListPerformance2.arrayListAddAtEnd 1 10000
@coderodde
coderodde / prioset.cpp
Created July 12, 2022 12:35
prioset.exe
#include <Windows.h>
#include <iostream>
#include <sstream>
#include <string>
using std::wcout;
using std::wcerr;
using std::wstring;
using std::wstringstream;
@coderodde
coderodde / Demo.java
Last active March 19, 2022 02:43
General LCA in Java
package com.github.coderodde.generallca;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public final class Demo {
private static final Map<String, TreeNode> TREE_MAP = new HashMap<>();
private static final LCAComputer LCA_COMPUTER = new LCAComputer();
@coderodde
coderodde / Dijkstra.pm
Created March 1, 2022 13:18
Dijkstra in perl
package Graph::Dijkstra;
use strict;
use warnings;
use Carp qw(croak carp);
use English qw(-no_match_vars);
$OUTPUT_AUTOFLUSH=1;
@coderodde
coderodde / Node.java
Last active January 15, 2022 11:13
Reversing a sublist of a singly-linked list in constant space and at most one pass (Java)
package com.quora.algo.list;
public final class Node {
public final int value;
public Node next;
public Node(int value, Node next) {
this.value = value;
this.next = next;