Skip to main content
Filter by
Sorted by
Tagged with
Advice
0 votes
0 replies
20 views

I’m working on the Ford-Johnson algorithm and trying to nail down the insertion order for betas.  I am unsure to apply the Jacobsthal numbers to the insertion indices tied to the original pairing ...
hermeszi's user avatar
1 vote
1 answer
114 views

For a game I'm working on, I'm starting with an 8x8 int array with all values zero. Then I'm randomly placing a single non-zero value in each row/column in such a way that there's only a single non-...
Lisa's user avatar
  • 167
0 votes
2 answers
77 views

I was working on Leetocde 108: Convert Sorted Array to Binary Search Tree. The input is a sorted array of integers, and the goal is to return a height-balanced binary search tree (BST), meaning that ...
MWu's user avatar
  • 1
Advice
0 votes
2 replies
71 views

I have a triangulated surface mesh in Python (PyVista Polydata) and a set of pre-defined boundary points — four ordered arrays defining lead edge, trail edge, root, and tip. I want to remesh the ...
Mark0371's user avatar
0 votes
1 answer
60 views

I have a piece of modelica code in a long when-elsewhen statement that uses reinit() for a continuous time variable and with if-elseif embedded in an equation section. In some cases, if a specific ...
AngeliqueR's user avatar
-7 votes
2 answers
175 views

I have been trying to solve this problem as a beginner in C++: The problem is that, when using AI, it almost always provides an answer that is way too complex in both syntax and logic. When I prompt ...
Georges_ABG's user avatar
2 votes
1 answer
107 views

I am learning about Dynamic Programming and I've implemented a recursive algorithm to solve the "Climbing Stairs" problem (which is essentially finding the N-th Fibonacci number). The basic ...
Yevhen Ivashchenko's user avatar
Advice
2 votes
2 replies
106 views

I am building a simple grid-based game and I want to implement different pathfinding behaviors for different types of NPCs. For example, some should move using A* (for efficiency), while others might ...
Yevhen Ivashchenko's user avatar
Advice
2 votes
5 replies
152 views

I need your advice. I am learning Java programming. I know the Java basics, object oriented programming and also Swing and AWT. These days I understand that I have to learn algorithms and data ...
Ashtar Reza Entezar's user avatar
Best practices
1 vote
10 replies
213 views

Context I'm just getting back into programming as a hobby, and I wanted to try making a compiler. I'm currently making the lexer, and when checking if a token is an operator, I use binary seach to ...
IllusiVeXI _ 11's user avatar
Advice
0 votes
7 replies
93 views

I have been trying to replicate Perlin Noise in Python using the Pygame module, the steps I took was this: 1. Window size is (1600, 1200) this window is split into a grid of 40 x 40 pixel Cells, so ...
wert01's user avatar
  • 1
Best practices
0 votes
3 replies
67 views

I’m working on a large-scale combinatorial optimization problem that combines aspects of exact set cover and length-constrained routing. Problem Description I have ~20,000 points (nodes), each with 2D ...
user32559875's user avatar
2 votes
1 answer
227 views

As far as I understand lower_bound is just a >= search operation. However, the following code snippet works: vector<size_t> udata = {5, 4}; vector<size_t>::const_iterator it = ...
khteh's user avatar
  • 4,366
Advice
0 votes
7 replies
131 views

So I am working on a program that needs to detect which nodes (if any) in a directed graph are involved in a cycle. My question is, is it more efficient/less bug prone to just do Kahn’s Algorithm and ...
the_merchant_man's user avatar
Advice
1 vote
6 replies
89 views

Given a long list of (unique) names, as well as an absolute frequency for each name, what is an efficient algorithm to select a random subset that is (more or less) representative of the entire list? ...
dizzy's user avatar
  • 1
3 votes
1 answer
91 views

I'm currently learning to make a Gomoku ai script that uses minimax algorithm along with alpha beta pruning and other methods to improve performance. In this current state, I've implemented a ...
littlesky33's user avatar
3 votes
2 answers
212 views

In order to cross-compile with Clang a C code which uses CHAR_BIT there is a need to include <limits.h>. To include <limits.h> there is a need to specify both --sysroot and -isystem ...
pmor's user avatar
  • 6,929
1 vote
2 answers
203 views

So I know from physics that position at a given time can be calculated using its derivatives like this: Now I know this looks awfully similar to Taylor series: In fact they are exactly the same. ...
Ξένη Γήινος's user avatar
Advice
0 votes
5 replies
132 views

I have a uint32_t key with 2-4 bits set, and I have a perfect hash map. Right now, with a python script, I brute force to find kMul such that all the keys are in separate locations. The keys are ...
weineng's user avatar
  • 364
Advice
0 votes
11 replies
103 views

The original article on scapegoat trees by Galperin and Rivest is quite interesting, and so seem to be all the courses, lectures, and descriptions, like OpenDataStructures and also with a lesson in ...
LuC's user avatar
  • 433
Advice
3 votes
6 replies
111 views

The intent of the system is to identify the place where the person's signature should go in a PDF. I am trying to find the best matches to a complete human name. I'm parsing the PDF using pdfplumber ...
jojusuar's user avatar
Best practices
5 votes
5 replies
132 views

I am currently developing an AI-driven fashion recommendation system, specifically focusing on a "Multi-modal Context-Aware Decision Model." A critical component of my recommendation engine ...
王振宇's user avatar
Advice
1 vote
7 replies
149 views

Suppose there is a bus service operated by an institute. But the employees don't know where the bus currently is. I want to build a system where the employee will know the exact location and estimated ...
Nure Tahsin Ullah's user avatar
1 vote
3 answers
238 views

I have decided to implement code to generate tangent numbers as a self-imposed programming challenge. I have succeeded in doing so, but not as efficient as I want it to be. What are tangent numbers? ...
Ξένη Γήινος's user avatar
Advice
0 votes
6 replies
115 views

I was solving the algorithm problem: find all unique substrings from the string, using sets. Here is the model solution, but I can't understand what line 6 means. Why does the end go up to length + 1? ...
Ilona's user avatar
  • 21
Advice
0 votes
5 replies
112 views

P(n) = sum_{k=0}^{100} [ p_k * product_{j=0, j≠k}^{100} (n - j)/(k - j) ] this is called a polynomial interpolation formula which gives a streak of 100 prime numbers higher than Euler's n²+n+41 which ...
user avatar
5 votes
1 answer
311 views

I need to add many fractions together. I don't use float because IEEE-754 Double Precision Floating Point has only 53 bits for mantissa thus 53 * log10(2) = 15.954589770191003 accurate decimal digits. ...
Ξένη Γήινος's user avatar
Best practices
2 votes
7 replies
152 views

This is related to this question. Basically, I need to add many fractions together. Seems simple enough? Except it isn't simple. I can't use fractions.Fraction class, that thing stupidly does fraction ...
Ξένη Γήινος's user avatar
10 votes
2 answers
381 views

With std::ranges::max, it is possible to use a projection as follows std::vector<std::tuple<char,int,double>> v = { {'a',2,1.0}, {'c',1,3.0}, {'b',4,2.0}, {'d',3,4.0} }; auto m = std::...
abcdefg's user avatar
  • 5,615
Advice
1 vote
11 replies
93 views

Let a "branching" operation be an operation that, given a finite sequence of integers, increments and duplicates one element in place. For example: (3,1,4,1,7) → (3,1,5,5,1,7) A tree ...
sitiposit's user avatar
  • 149
Advice
0 votes
31 replies
302 views

Unlike conventional collision detection algorithms (using right-angled triangles), I created an algorithm using the theta value with objects. (Theory, etc., got a little help from the Gemini, but I ...
codingman1's user avatar
Best practices
0 votes
8 replies
84 views

I have a sampled 1D signal that contains very sharp periodic peaks. The peaks are narrower than the sampling resolution, and the lower part of the signal contains noise. The goal is to estimate the ...
user32361358's user avatar
10 votes
1 answer
675 views

I’m looking at the classic “is binary tree balanced” problem (LeetCode 110 style): Given a binary tree, determine if it is height-balanced. A binary tree is height-balanced if for every node, the ...
FluidMechanics Potential Flows's user avatar
4 votes
1 answer
113 views

I am studying Depth First Search (DFS) on undirected graphs and I am confused about discovery order. I have attached a figure of an undirected graph with DFS discovery (d) and finishing (f) times ...
Mayesha Tasnim's user avatar
1 vote
1 answer
229 views

I was fiddling with the Brainfuck esolang over the past few days, and tried to implement an increment operation on an N-byte-wide integer in big-endian format. Note that I am imposing a structural ...
so8714's user avatar
  • 19
2 votes
0 answers
186 views

I need to apply a blur/filter to a 2D grid where the blur parameters vary per pixel based on geometric calculations. I have: Image: 2D grid of values Viewing angles: 2D grid where each pixel has an ...
Nikos's user avatar
  • 499
0 votes
0 answers
71 views

I have been following the Cormen algorithm for RB trees, but I have a question regarding deletion, specially in this case: 38 31 41 all the nodes are black and I want to delete 38. After ...
Little's user avatar
  • 3,487
0 votes
1 answer
159 views

I am making a drawing application and i have to show the borders of the pencil. To know where to place the pixels I use a list of integer offsets from the cursor that make up a shape, so the cursor is ...
Gabbinetto's user avatar
Tooling
0 votes
11 replies
126 views

I'm working on a project in which I need to filter out specific strings from an inconsistent API, where the strings are not always what I want. I need to filter out eligibility for different education ...
23emli's user avatar
  • 1
Advice
2 votes
4 replies
77 views

0-1 Knapsack problem is often used as a starting problem to understand dynamic programming. This problem can also be solved using backtracking. Now, backtracking explores all possible subsets and uses ...
Hades's user avatar
  • 11
Best practices
2 votes
17 replies
6k views

General question I wonder how to express any code of the form while True: state_before = some_function(my_object) # algorithmic code goes here state_after = some_function(...
flonk's user avatar
  • 3,916
Advice
0 votes
3 replies
83 views

i am learning about big o notation and need a little bit of clarity before i diverge into the wrong path. my understanding is o() is suppose to represent the time it takes for a program to do a task ...
booboobearboy283's user avatar
Advice
0 votes
5 replies
104 views

As the title says, how can i convert a value that i have from a longitude or latitude from degrees to meters ? The task is basically to calculate MAE errors for x,y,z of trajectory prediction, MAE Z ...
Destr's user avatar
  • 1
Advice
2 votes
10 replies
70 views

I have a 3d scan of a metal pipe and I can slice it at different heights. When looking at a cross-section of a new pipe, the data should match the shape of a perfect circle, but due to erosion the ...
G-Man's user avatar
  • 1
Advice
6 votes
12 replies
6k views

I need a fast algorithm to compute fixed-point euclidean distance in 3D. I'm really struggling to find a fast solution. I am working on a 32-bit RISC-V processor where I have fast multiply, but no ...
Charles Lohr's user avatar
  • 1,070
Best practices
5 votes
6 replies
126 views

I have an array of arrays which are not necessary of the same size which I want to combine in the following way. Each nested array is scanned in the order they appear in the main array. The scanned ...
Aristide's user avatar
Best practices
2 votes
1 replies
80 views

I’m building a chatbot using Python, pydantic_ai, google_genai, and the gemini‑2.0‑flash‑lite model. The bot includes a module responsible for retrieving context from a knowledge base (RAG). The ...
Przemysław Ozga's user avatar
3 votes
1 answer
479 views

This is a simple question, but will be a little long so I can give all the context to what is happening. Essentially, this is a code question/issue and the physical context behind is just to ...
Silvio sjsj's user avatar
Advice
0 votes
7 replies
128 views

I’m looking to understand both: A brute force solution An optimal solution (in terms of time and space complexity) The input is a slice of integers, for example: nums := []int{10, 5, 20, 8, 15} ...
Jamil Noyda's user avatar
  • 3,677
Best practices
1 vote
14 replies
6k views

The problem is: Cover an N × N square room with square tiles (the tiles do not all need to be the same size) without overlapping, where the side length of each tile is integral and less than N. What ...
commonplace-brid's user avatar

1
2 3 4 5
2430