Questions tagged [java]
Java (not to be confused with JavaScript) is a class-based, object-oriented, strongly typed, reflective language and run-time environment (JRE). Java programs are compiled to bytecode and run in a virtual machine (JVM) enabling a "write once, run anywhere" (WORA) methodology.
10,907 questions
0
votes
0
answers
36
views
A Java program for compressing/decompressing files via Huffman algorithms (version 1.1.1)
Intro
(See the version 1.0.0.)
(See the GitHub repository.)
This time I have got rid of some generic classes and adapted the entire code base to deal with byte ...
-5
votes
0
answers
79
views
Object oriented programming deque implementation (after another second thought)
After another second thought from the second thoughts series Object oriented programming deque implementation (after second thought) it turns out using static methods alternatively to method ...
4
votes
2
answers
347
views
HuffmannEncoder.java - computing prefix codes for arbitrary (generic) alphabets
(See the continuation of this post at HuffmanEncoder.java - computing prefix codes for arbitrary (generic) alphabets - Take II.)
I have this Java implementation of the Huffmann encoding. It looks like ...
3
votes
2
answers
844
views
Three non-negative integer encoding techniques in Java
Intro
In this post, I will present three (3) non-negative integer encoding techniques:
Elias gamma coding
Elias delta coding
Golomb-Rice coding
Code
...
2
votes
2
answers
254
views
Benchmarking in Java some super linearithmic sorting algorithms
Intro
A sort is called super linearithmic if its running time is \$\omega(N \log N)\$. For example, \$f(N) = \omega(g(N))\$ means that \$f(N)\$ grows "faster" than \$g(N)\$. In this post, I ...
-7
votes
1
answer
124
views
Object oriented programming deque implementation (after second thought)
The java.util.Deque implementation from Object oriented programming deque implementation that consists of three elements linked arrays, each array holding reference ...
1
vote
1
answer
110
views
Jump point search in Java for faster pathfinding in grid mazes
(Refer to the entire repository in GitHub.)
How it looks like
Intro
This time, I present my take on Jump point search that I translated from Javascript (PathFinding.js/src/finders/JumpPointFinderBase....
4
votes
1
answer
181
views
API having flow - normal flow along with background poller(it also involves events which is not shown here)
We have an API in which we call external service with a tracking id.This first part of the API workflow makes an entry to the DB as SUBMITTED after the call to first external API say /E1 finishes and ...
4
votes
2
answers
142
views
Dijkstra's algorithm for non-uniform undirected hypergraphs
Intro
(Repo here.)
A non-uniform undirected hypergraph is a generalization of an undirected graph. It is defined as \$H = (X, E)\$, where \$X\$ is the set of vertices and \$E \subseteq \mathcal{P}(X)\$...
5
votes
2
answers
418
views
Ordinary insertion sort vs. straight insertion sort in Java (benchmark)
Intro
So this time I wanted to find out which of the two insertion sort flavours are faster:
Code
io.github.coderodde.util.StraightInsertionSort.java:
...
4
votes
1
answer
291
views
Computing most probable (reliable) path in a probabilistic graph (take II)
Intro
A probabilistic graph \$G = (V, E)\$ is an undirected graph with weight function \$w \colon E \rightarrow [0, 1]\$. In the most reliable path problem we -- given two terminal nodes \$s \in V\$ ...
1
vote
0
answers
64
views
PathFinding.java: Drawing a random perfect maze via randomized DFS
Intro
Still working on PathFinding.java. This time I concentrate on three private methods of GridModel that are responsible for generating random perfect mazes. A maze is perfect if for each two cells ...
4
votes
1
answer
176
views
Checking for string isomorphism in Java
Intro
Two \$n\$-strings \$s = \langle s_1 \ldots s_n \rangle \$ and \$z = \langle z_z \ldots z_n \rangle\$ are considered isomorphic if and only if there exists a bijection \$f\$ such that for all \$...
0
votes
0
answers
23
views
PathFinding.java: SettingsPane class
Intro
I am still working on PathFinding.java. This time I need to get reviewed the class responsible for choosing the heuristic function, the finder implementation, just to mention a few of settings ...
0
votes
0
answers
36
views
CodeView Custom JavaFX Node
I created this to learn about creating custom controls using Region. I did not do any testing of the Control, and it is limited to displaying Java only. I didn't need this for any reason other than ...
8
votes
2
answers
618
views
Own HTTP server implementation in Java with a simple template engine
I would like to hear what you think about my simple HTTP Server implementation with a template engine in Java.
Have I overlooked any "pitfalls or caveats", or is there anything else to note?
...
1
vote
3
answers
158
views
Is this exception handling missing anything?
This is the code. I'm uncertain about the last block.
...
4
votes
1
answer
106
views
Funny time with DNA: a \$k\$-mer index data structure in Java
(See the next iteration.)
This time I have programmed a simple data structure called \$k\$-mer index. The actual word \$k\$-mer is a synonym of substring of length \$k\$. This data structure is built ...
10
votes
2
answers
1k
views
Java: A fractal algorithm shows prime number patterning
The fully working example finds all primes (theoretically). In real life the FA is constrained by stack size. The theoretical run is important, because it proves that all primes have a deterministic ...
5
votes
6
answers
978
views
The Haversine formula in Java for computing distance along the Earth between two locations expressed in geographical coordinates
This time, I have implemented the Haversine formula:
io.github.coderodde.geom.Haversine.java:
...
5
votes
1
answer
407
views
Positive Integer Class Supporting Arbitrary Number of Digits
I have implemented an elementary positive integer class that supports addition, subtraction, and multiplication for an arbitrary number of digits using a singly linked list.
...
4
votes
1
answer
145
views
Implement a simple image captcha test yourself in Java and JS
First of all: I was looking for a simple image captcha solution for a website, but all I found were "Over-the-top" solutions for me. So I decided to write something to self.
I mainly use two ...
4
votes
2
answers
184
views
SimpleStackMachine.java - A virtual stack machine written in Java
In this post, I present my most recent result, a stack-based virtual machine programmed in Java. Frankly, I am lazy to write the unit tests since I am pretty much burned out with it. The full ...
1
vote
0
answers
45
views
Spring Boot RabbitMQ Publisher Configuration for Sending JSON Messages
The publisher class:
...
4
votes
2
answers
245
views
Calculating volume expressions of n -dimensional balls in Java - follow-up
Intro
(The previous/initial iteration is there.)
(The next iteration is there.)
This time, I have incorporated a nice answer by Martin R.
Updated code
...