All Questions
1,285 questions
1
vote
0
answers
33
views
Lock free Leaky Bucket Rate Limiter
I want to validate my solution for a lock-free leaky bucket rate limiter. Given a queuing capacity and rate limit per second, it should queue requests till capacity is reached and it should allow only ...
0
votes
0
answers
45
views
Fixed BIDDFS (bidirectional iterative deepening depth first search) in Java
Intro
I have this GitHub repository for doing pathfinding in directed unweighted graphs. This post is about BIDDFS proposed by Richard Korf in his paper.
Code
...
1
vote
0
answers
22
views
LibID: a Java library containing some iterative deepening algorithms for pathfinding on directed unweighted graphs
Intro
I have this GitHub repository containing some iterative deepening pathfinding algorithms.
Code
...
4
votes
3
answers
555
views
Finding Special Parts in a Word
Task description:
Imagine you have a long word made up of small letters like "a", "b", "c", ancd so on. Let’s call this word a puzzle word.
We want to look at all the ...
4
votes
1
answer
107
views
Efficient way to win points in chocolate bowl game
I'm working on an optimization problem involving a turn-based chocolate-sharing game, and I need help optimizing my current brute-force solution.
Problem Description:
You and your friend take turns ...
5
votes
4
answers
515
views
Count number of substrings in less time
Given an input string contains letters from 'a' to 'g'
Count how many substrings are there in the input string such that
frequency of any character inside the substring is not more than the
number of ...
4
votes
2
answers
530
views
Simple Java program to aggregate lines of a text file
I have just written a small application to aggregate the lines of a text file, for example to group the lines according to the frequency of IP addresses in a log file.
Would the code be sufficiently ...
3
votes
1
answer
84
views
Depth-first ListIterator over JTree
I wrote a depth-first ListIterator for JTrees.
Considerations:
It must be a ListIterator, ...
13
votes
5
answers
2k
views
solve n*m matrix processing in less time
I want to solve a problem in less time complexity. Here are the details:
Given an n*m matrix, n rows and m columns. Initially, the matrix is empty filled with 0s.
...
8
votes
1
answer
251
views
TF-IDF Implementation in Java
I have tried following the formulas for Term frequency–Inverse document frequency (TF-IDF) calculation and Cosine similarity calculation, and translated it into code. The results I get seems to be ...
4
votes
2
answers
122
views
Polynomial.java - multiplication algorithms: naïve, Karatsuba, FFT
Intro
This post is a supplement to Polynomial.java - a Java class for dealing with polynomials with BigDecimal coefficients. It presents the three polynomial multiplication algorithms. Given two ...
3
votes
1
answer
183
views
Getting all column vs. table regardless of alias using JSqlParser
I have been trying to get all column vs. table regardless of alias used, for example, assume this query
...
2
votes
1
answer
143
views
What is the most efficient way to figure out if a single number is prime for numbers from 2 up to 2,147,483,647 in Java?
As Java programmers, we can always use the BigInteger isProbablePrime() method or store manually all prime numbers in a HashMap. This question is about the most efficient way to figure out if a single ...
1
vote
0
answers
68
views
Negamax with Alpha-beta pruning for playing Connect Four in Java
I have this repository.
My main concern this time is my implementation of the Negamax algorithm with alpha-beta pruning:
...
4
votes
1
answer
107
views
Multithreaded Alpha-beta pruning for playing Connect Four in Java
Intro
(The entire repository is in GitHub.)
This time, I have parallelized the famous Alpha-beta pruning algorithm. The idea is that the parallel algorithm descends in a game tree (at least) 2 levels ...