Skip to main content

Questions tagged [algorithm]

An algorithm is a sequence of well-defined steps that define an abstract solution to a problem. Use this tag when your issue is related to algorithm design.

Filter by
Sorted by
Tagged with
5 votes
1 answer
417 views

Intro (See the version A Java program for compressing/decompressing files via Huffman algorithms (version 1.1.1).) (The full repository is here. It contains also some unit tests that do not fit in ...
coderodde's user avatar
  • 32.2k
4 votes
2 answers
347 views

(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 ...
coderodde's user avatar
  • 32.2k
4 votes
3 answers
474 views

Intro In this post, I will elaborate on A simple method for compressing white space in text (Java). Here, I have incorporated some advice offered by Chris. Also, this version preserves a single new ...
coderodde's user avatar
  • 32.2k
5 votes
1 answer
529 views

(The story continues in A simple method for compressing white space in text (Java) - Take II.) Intro Now I have that text space compressor. For example, ...
coderodde's user avatar
  • 32.2k
1 vote
1 answer
110 views

(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....
coderodde's user avatar
  • 32.2k
5 votes
2 answers
364 views

I want to begin by sincerely thanking the community for the invaluable feedback on my previous BRESort byte-sorting research. Your insights about enums, named constants, loop optimizations, and test ...
LazyCauchPotato's user avatar
7 votes
4 answers
679 views

I've created BRESort - an adaptive sorting engine that dynamically selects optimal algorithms based on data patterns. It achieves 3.6-4.2x speedup over stdlib qsort ...
LazyCauchPotato's user avatar
4 votes
2 answers
142 views

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)\$...
coderodde's user avatar
  • 32.2k
8 votes
2 answers
301 views

I've took inspiration from https://www.geeksforgeeks.org/cpp/kd-trees-in-cpp/ and implemented a kdtree library and I would like to get a review of it. The main target was to have a kd-tree ...
Pangi's user avatar
  • 370
0 votes
0 answers
62 views

Intro (See MostProbablePath.java.) This time, I elaborate on Computing most probable (reliable) path in a probabilistic graph (take II): instead of computing the most reliable path I now return \$k\$ ...
coderodde's user avatar
  • 32.2k
1 vote
0 answers
64 views

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 ...
coderodde's user avatar
  • 32.2k
7 votes
1 answer
878 views

I am building a chess engine in C++ and currently working on the move generation. To measure performance I use perft, but my main goal is to make the move generator itself faster. I already use ...
Viliam Holly's user avatar
3 votes
1 answer
138 views

This is the third iteration of the code from Calculate optimal game upgrades, v2 and Calculate optimal game upgrades. I'm looking for suggestions to further optimize this code. A brief summary of the ...
ayaan098's user avatar
  • 125
5 votes
3 answers
569 views

I need to solve the following competitive programming problem from coderun.ru: Strength of a Pyramid Top The pyramid consists of n horizontal layers of blocks: the first layer contains n blocks, the ...
Stony's user avatar
  • 107
2 votes
1 answer
128 views

I need a function which finds the left and right neighbor-element within an integer-array, based upon a given index. If the given element is 0, then it shall return largest index as left neighbor. ...
michael.zech's user avatar
  • 5,044
1 vote
0 answers
65 views

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 ...
Pritish Nayak's user avatar
6 votes
3 answers
762 views

The problem is: You have Q queens and R rooks on a board with sides of length (R+Q) ≤ 8, and you have to place all the pieces so that none attack any other piece. Each square on the board has a score ...
turral's user avatar
  • 127
2 votes
0 answers
56 views

The treewidth is a measure of the count of original graph vertices mapped onto any tree vertex in an optimal tree decomposition. I wrote Mathematica code to calculate Treewidth based on the Python ...
138 Aspen's user avatar
  • 469
5 votes
3 answers
1k views

Project Euler Problem #1 Multiples of 3 or 5 states: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of ...
toolic's user avatar
  • 16.3k
4 votes
0 answers
85 views

I have implemented the SHA1 algorithm in Zig, as a learning exercise, to teach myself both Zig and the actual algorithm behind SHA1. Now the second part I think I understood well enough. The ...
Rohit Tanwar's user avatar
5 votes
2 answers
102 views

Is there a better way to calculate distance scores for local alignment than this? Or is the method that I'm currently using robust enough? The full code is here with the actual alignment ...
dawnandrew100's user avatar
7 votes
3 answers
580 views

I've made a program for randomly splitting game participants into different teams. The code works and solves the problem. I'm interested in advice on what you'd do differently or better. ...
tomi bell's user avatar
2 votes
1 answer
217 views

I decided to work on an idea I had to 'optimize' the classic C function strstr. Most of the implementations I had seen that did not make use of advanced ...
mindoverflow's user avatar
3 votes
1 answer
86 views

This is a part two. The problem originates from here, it is solved for \$n<11\$. A GitHub repository for this code, printing paths, and a collection of all proven best paths, it is open to ...
tomka700's user avatar
  • 203
4 votes
3 answers
570 views

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 ...
CodeCrusader's user avatar

1
2 3 4 5
103