Comment by coderodde on A Dynamic Bitset that I wrote and will use in my...
@ChristianPhillips No. You won’t increase it by 2^1000… The size will grow from 10_000_000 to 20_000_000.
View ArticleComment by coderodde on Brainfuck to C transpiler
@Harith Note that in Linux, there is man7.org/linux/man-pages/man3/basename.3.html
View ArticleBit vector in Java supporting O(1) rank() and O(log n) select() - follow-up
(This post is the continuation of Bit vector in Java supporting O(1) rank() and O(log n) select(). It resides here (version 1.0.1).)Basically, I have implemented everything haroldsuggested, except...
View ArticleSemi-dynamic range minimum query (RMQ) tree in Java
IntroductionI have this semi-dynamic range minimum query (RMQ) tree in Java. It is called semi-dynamic due to the fact that it cannot be modified after it is constructed. However, the values associated...
View ArticleThread-safe strtok in C
Since strtok is not thread-safe, I decided to practice and write a thread-safe version of the same function. This code and the demo runner may be found at...
View ArticleA simple unit test library for C
I have rolled this simple unit test library for C:com_github_coderodde_my_assert.h:#ifndef COM_GITHUB_CODERODDE_MY_ASSERT_H#define COM_GITHUB_CODERODDE_MY_ASSERT_H#include <stdbool.h>#include...
View ArticleA simple unit test library for C - version II
I have improved my code here and it looks like this:Codeassertlib.h:#ifndef COM_GITHUB_CODERODDE_ASSERTLIB_H#define COM_GITHUB_CODERODDE_ASSERTLIB_Hvoid print_test_statistics();int...
View ArticleThread-safe strtok in C - version II
After improving Thread-safe strtok in C according to vnp's and Harith's nice comments, I ended up with this:Codestrtok_arr.h:#ifndef COM_GITHUB_CODERODDE_THREAD_SAFE_STRTOK_H#define...
View ArticleComment by coderodde on Skip list -based Map in Java
@morgwai Excellent idea! I will give it a try, thanks!
View ArticleComment by coderodde on Generic stack implementation
@Harith If you allow NULLs as a datum, you have no much choice than abort():ing.
View ArticleFirst order hidden Markov model with Viterbi algorithm in Java
IntroductionA first order HMM (hidden Markov model) is a tuple \$(H, \Sigma, T, E, \mathbb{P})\$, where \$H = \{1, \ldots, \vert H \vert\}\$ is the set of hidden states, \$\Sigma\$ is the set of...
View ArticleEfficient least-significant digit (LSD) radix sort for int keys in Java
This one is my attempt at LSD radix sort:Codecom.github.coderodde.util.LSDRadixsort.java:package com.github.coderodde.util;import java.util.Arrays;/** * This class provides the method for sorting...
View ArticleA JavaScript plugin for rendering radial pie charts
(See also An extended JavaScript plugin for rendering radial pie charts.)I have this JavaScript plugin:rodde-radial-pie-chart.js:class RadialPieChart { static #rgb_alphabet_set = new Set(); #canvas_id;...
View ArticleComment by coderodde on Efficient least-significant digit (LSD) radix sort...
@greybeard True, but even with random.nextInt(1000), the LSD radix sort for ints is 42% faster than Arrays.sort.
View ArticleBidirectional Dijkstra d-ary heap
This is my very first data structure written in Perl for a d-ary heap:package BidirectionalDijkstra::DaryHeap;use strict;use warnings;use POSIX;require Exporter;our @ISA = qw(Exporter);our $MAXIMUM_INT...
View ArticleThread pooled bidirectional breadth-first search in Java for graphs with slow...
IntroThis post follows Thread pooled bidirectional breadth-first search in Java for graphs with slow node expansion - part I/II: the algorithm. Basically, these are build patterns leveraging fluent...
View ArticleThread pooled bidirectional breadth-first search in Java for graphs with slow...
(This post has part II/II.)IntroThis time, I have this GitHub repository. The idea is that if the graph node expansion is slow (for example, in the case where you ask a web server to return some data),...
View ArticleJava classes for downloading all in-coming/out-going links of an article in...
(The entire project is in GitHub.)IntroductionThis project provides facilities for generating in-coming or out-going links in a given Wikipedia...
View ArticleWikiGameKiller.java - a program for solving Wiki game instances
IntroI have this GitHub repository. Basically, it is a command-line utility for searching automatically for shortest link paths in the Wikipedia article graph.Limitations(As of now, it is possible that...
View ArticleWikiGameKillerFX.java - a JavaFX GUI program for solving the Wiki Game instances
I have this GitHub repository. In Wiki Game, players agree on random source and target articles, and attempt to navigate from the source to the target using least number of links. If there is a tie,...
View ArticleAnswer by coderodde for (Another) text formatting method with word wrapping...
Advice I - Package your classes wellI suggest you write:package com.tobias.grothe.text.util;Advice II - Make Utils.java non-constructibleI would hide the constructor of Utils since it makes no sense to...
View ArticleAnswer by coderodde for Colorful Subgraph Dynamic Programming Solution and a...
As I am not a professional Python developer, I won't concentrate on language stylistic issues such as explicit typing. However, I have some background in algorithms and, so, I will stick to that point...
View ArticleComment by coderodde on Binary heap based priority queue implementation in C#
Do you host this anywhere? Maybe GitHub? I would have liked to see also the tests and demo program.
View ArticleAnswer by coderodde for Breadth-first search
Advice I - incorrectnessYour print(bfs('a','f', path,0, [])) prints None, so your implementation is plain wrong.Advice II - no recursion pleaseBasically, you have a depth-first search.Advice III -...
View ArticleAnswer by coderodde for A tic-tac-toe game in C
Advice I - stdio.h:I was able to compile your code in Visual Studio only via adding #include <stdio.h>. Please, add it to your main.c.Advice IIYou have:int g_board[9];Why not:int...
View ArticleAnswer by coderodde for Creating random music covers using Conways Game of...
Advice I - Add missing main(String[])I suggest you addpublic static void main(String[] args) { new Cover();}Advice II - Can make the pixelDataprivate:You have the following:boolean[][] pixelData = new...
View ArticleAnswer by coderodde for Binary heap based priority queue implementation in C#
Advice I - where TPriority : notnullI would add where TPriority : notnull to the class declaraction, since the priority keys are always required.Note II like your...
View ArticleAnswer by coderodde for Snail matrix in Java
Advice I - Rename IntPairI guess, the better name for IntPair would be IntCoordinate.Advice II - Simplfiy moveCursorToNextLocationprivate void moveCursorToNextLocation() { while (true) { final int x =...
View ArticleSnail matrix in Java
Inspired by this post, I decided to solve that problem in Java. The idea is to decide on an \$n \in \mathbb{N}\$, create a square matrix \$M_n = \mathbb{N}^{n \times n}, \$ and set the integers \$1, 2,...
View ArticleSnail matrix in Java - version II
(This post is the continuation of Snail matrix in Java. Also, this post has an continuation.)As previously, a snail matrix is any square matrix \$M_n = \mathbb{N}^{n \times n}\$ with cell elements from...
View ArticleSnail matrix in Java - version III (generalizing)
Once again, in the previous version, Alexander Ivanchenko helped me with his awesome answer.Now, I have improved the toString() and, also, generalized the class to handle matrices of any dimensions,...
View Article
More Pages to Explore .....