121,368 questions
1
vote
1
answer
21
views
Algorithm for finding enclosing circles for 3 other circles
I have 3 circles which may/may not be touching each other. Is it possible to find algorithmically circle which contains all those circles and have the minimal size?
It seems to be smallest-circle ...
1
vote
0
answers
16
views
Latex formulas common parts detector
I have a task to make an anti-plagiarism of formulas. It is necessary for it to highlight similar places in two formulas (example in the photo). But there is a problem, after I found these similar ...
-1
votes
0
answers
20
views
How do I model the service composition problem?
My question is about service composition. But I didn't find a solution similar to mine.
Problem description:
Each service has its own type and declares its dependent service type (The number of ...
1
vote
2
answers
36
views
Z-Order problem while displaying isometric tiles
I have a little problem while displaying isometric tiles in my school game.
The fact is that I suppose everything is ok with my code...
Here is how it's organised:
architecture: MVC + ECS
everything ...
-1
votes
0
answers
21
views
How to determine if a vertex is covered in an optimal solution using a parametric feasibility test?
Question:
I am trying to understand how a parametric search feasibility test works and how it applies to the problem below:
Problem Statement:
The figure below illustrates an edge (u,v)(u, v)(u,v) ...
3
votes
8
answers
96
views
Finding the last unique string in a list
I was doing some coding on CodeSignal to refresh my knowledge.
I was asked this question:
Suppose you've got a list of words, let's say ['apple', 'banana', 'apple', 'mango', 'banana']. Each word ...
0
votes
1
answer
28
views
What constant time function applied to search for a set in all sets using a smaller set? Can bloom filters be compared with eachother?
I have messages that are grouped into separate sets - they are unordered String keywords.
I want to search for patterns in the messages by matching sets to other sets.
This is set intersection but I ...
-2
votes
0
answers
25
views
javascript swap two elements in an array issue using arrays destructuring [duplicate]
I'm a novice in Javascript and I was stuck in a leetcode question due to the js syntax, which involves swapping two elements in an array. The complete code in JS is shown below:
/**
* @param {...
0
votes
2
answers
82
views
Solving box stacking problem in n log n, no rotations allowed
I need to solve a box stacking problem with the following rules:
Box is a tuple {x, y, height}.
You CAN NOT rotate boxes.
To stack a box b1 on top of another box b2, b1.x<=b2.x and b1.y<=b2.y.
...
-1
votes
0
answers
26
views
How to solve a coin change variation: find the minimum number of coins to reach or exceed a target value k [closed]
I am trying to solve a variation of the coin change problem. Given a target amount k and a list of n coins with infinite supply (e.g., c[1] = 2, c[2] = 5, c[3] = 10), the goal is to determine the ...
-9
votes
0
answers
115
views
Rectangle packing around center point [closed]
Edit: The question is about "minimum-area rectangle packing" algorithm - with the difference that rectangles are grouped "around the center point" instead of inside of a bin.Image ...
0
votes
0
answers
27
views
How do I format the data in an Excel spreadsheet?
There is a file with an **Excel ** spreadsheet containing the following type of data:
россия, московская область, ленинский район, г.видное, ул.заводская, д.6, кв.22
643,163000,78,,санктпетербург г,,...
1
vote
1
answer
28
views
How to define a normal Markov algorithm (NMA) to swap two ternary numbers separated by the symbol "^"?
I'm trying to write a normal Markov algorithm in an emulator to swap two ternary numbers separated by the symbol "^". For example, for input "120^210", the result should be "...
-1
votes
0
answers
27
views
How to split and spelling correct arabic text without spaces into list of words
I'm looking for a way to split and spelling correct the arabic text without spacing, just like in Microsoft Word for example:
تشرابالقطط الحليب
Expected:
[تشرب، القطط، الحليب]
If there Is no ready ...
-2
votes
1
answer
50
views
what is the output of this simple recursive function? can you explain in detail?
void test(int start)
{
for(int i=start; i<2; i++)
{
printf("%d", start);
test(i+1);
}
}
--> test( 0 );
I know the output will be 0-1-0, but I don't ...
1
vote
0
answers
55
views
Is it possible to optimize my sort algorithm - packetsort
To give some back story, I have a program that does real-time data tracking/trending. It receives packets of data, asynchronously, from multiple sources that is presorted in ascending or descending ...
-1
votes
0
answers
43
views
Looking for a compact decompression algorithm [closed]
Here is my use case: I have a very very small amount of flash memory on my device. I have a data array of about 10k in length. Memory is so tight that even this is worth compressing. But I would need ...
2
votes
1
answer
43
views
Insert sequence of formatting that can overlap into a string at specific locations
I have this problem, I refactored jQuery Terminal unix_formatting extension (a formatter) that process ANSI escape codes, based on paid work. The task that I was hired for was to only output text, but ...
0
votes
1
answer
39
views
Min Pairing Heap - How to increase key faster than O(logn)?
I know that a min pairing heap can decrease a key faster than O(logn). However, is there any way to make the increase key operate also faster than decrease key to the top, remove, than insert new ...
1
vote
0
answers
45
views
Minimum dominating subgraph
A graph G(V,E) is defined by a set of vertices V and a set of edges E. Given W⊆V, find a connected subgraph G'(V',E') of G that satisfies the following conditions:
i) ∀p∈V,∃p'∈V' such that p′ is ...
0
votes
3
answers
96
views
Maximum integral flow with amplifying edges
How to solve the problem of maximum integral flow with amplifying edges: where one unit of flow becomes w units after passing an edge with amplification value w?
To be precise I want to solve the ...
-1
votes
0
answers
33
views
python grid click algorythm [closed]
This is my code I wrote so far. But I am stuck at hardest part.
code:
import time #import for sleep function
from pynput.mouse import Button, Controller #import of pynput functions
from pynput....
-3
votes
1
answer
89
views
contour tracing with hole detection for 2D scribble [closed]
I have a Qt C++ program that lets the user draw scribbles freely. Currently this functionality is implemented, but I rather want to implement a contour tracer with hole searching algorithm, and show ...
0
votes
0
answers
14
views
How to use wincnn for a big input matrix?
Input matrix size is 16*11, kernel size is 3*3, stride and padding are 1, how to calculate A, G and B by using wincnn?
-2
votes
0
answers
26
views
Get a size of a vertex in oriented graph with weights [closed]
I am working with graph algorithm of circular laying attributed hierarchical graph with ports and there is a term in it that I do not understand. It is the size of a graph vertex. Moreover, in such a ...
1
vote
0
answers
38
views
Interpolation 2D [closed]
I'm not sure about the word interpolation for my problem.
I've a csv log containing data and timestamp, logged at 200Hz logically.
Unfortunately the timestamp between each line is not perfect, so the ...
-2
votes
0
answers
36
views
algorithm test: min cost to remove bad phase in password string [closed]
Question 1 here
It is a bit long, but I will summarise what is really asking.
test case 1:
input1, bad phase in password:
**bcb** (it can be rearranged as **bbc**, **cbb**)
input2, password:
...
0
votes
0
answers
15
views
Dynamic Limb Control Pathing
I want to write a program that will take a model with limbs and given restraints and (provided the model can do it) will be able to control the model and maximize it's speed.
To put it more plainly, I ...
-7
votes
0
answers
63
views
Fill container with random width/height elements leaving least gaps [closed]
Objective is a fixed w/h div container, filled with elements of random width and height in a such way that they'll leave the least visual gaps between them.
Sides and top/bottom don't need to be even....
2
votes
3
answers
127
views
Having trouble understanding Linked List in C
#define SIZE 100000
// 1. hash_function() is a function that return an int
// 2. snowflake_node
typedef struct snowflake_node {
int snowflake[6];
struct snowflake_node *next;
} snowflake_node;
...
0
votes
0
answers
36
views
Skip-lists in Data Structure
no. of comparisons for deletion : 3
no. of comparison of search(77) : 7 (halt)
but in the given answer source, find 5, 10 respectively.
can anyone provide the correct answer with explanation .
I ...
1
vote
1
answer
33
views
Efficient Computation of convolution-like expression [closed]
Let p(z_i | x_i) for i=1...m be some probabilities, where x_i and z_i are in {0,1}. I want to efficiently compute the following:
for all z_1...z_m.
I know that convolutions can be computed ...
1
vote
1
answer
55
views
How do I make an algorithm for tracing lines given a set a points?
I need an algorithm to position lines on a set of points in a 2D environment. The algorithm should identify collinear points within a specified tolerance and place lines accordingly. Each resulting ...
0
votes
0
answers
39
views
Programmatically determine L1 icache size, line size?
I have already searched for related issues, but all of them are related to dcache. I can't think of a way to determine the characteristics of L1 icache.
-3
votes
2
answers
100
views
Why is my vector 'folding' algorithm not working correctly?
First, here's my code:
#include<iostream>
#include<fstream>
#include<vector>
using namespace std;
int main() {
vector<int> vector1;
vector<int> ...
0
votes
1
answer
47
views
How to efficiently match different versions of grouped elements?
I'm trying to remap primary keys between versioned data and code releases with as small a diff as possible.
I have a list of elements, e.g. [a,b,c,...,j], and some deterministic process that assigns ...
-4
votes
0
answers
59
views
Crypto bot strategy [closed]
I’m working on a cryptocurrency trading bot that integrates with the Valr API, focusing on the ETHZAR (Ethereum to South African Rand) pair. The bot uses WebSockets to receive real-time market data ...
0
votes
1
answer
64
views
Knapsack 0/1 variation maximize the number of objects with independent weight restrictions
I'm trying to use dynamic programming to solve a knapsack variation, where you are given an array of containers, each of them having a weight, a resistance and an id, I need to find the tallest pile ...
0
votes
1
answer
58
views
Summation of nodes reachable starting from every node present in given DAG with restriction on number of childs per node
That's a problem from XXX Polish Olympiad in Informatics, stage II, titled "Wspinaczka". Link to original problem statement in Polish.
Let's compress above story into algorithmic problem ...
0
votes
1
answer
60
views
How can I update previous object keys while iterating through a single loop?
I am trying to solve the following challenge:
Description
Given an input string, count occurrences of a given emoji (encoded as :apple:) for each user after encountering their user name (encoded as &...
0
votes
0
answers
67
views
I implemented md5 in cuda, but it returns the wrong hash?
I am trying to implement md5 in cuda, here is the code:
__device__ uint32_t K[] =
{ 0xd76aa478,0xe8c7b756,0x242070db,0xc1bdceee,0xf57c0faf,0x4787c62a,
0xa8304613,0xfd469501,0x698098d8,...
-2
votes
0
answers
36
views
Paint bucket algorithm [closed]
Does anyone know the fill color paint bucket algorithm, like the one used in Microsoft Paint? I have a canvas that was created using raylib, like this:
# Create the canvas as a render texture
#--------...
3
votes
1
answer
97
views
Arithmetic shift-right integers with half rounding toward zero
I am looking for an efficient algorithm that computes arithmetic shift-right of integers that rounds to nearest integer with halfway rounding toward zero behavior. An answer can be a proper ...
1
vote
2
answers
45
views
Converting entity list into JTree model
We get a list from DB that we need to convert into a JTree. The trick is to build a model.
The rules:
Each record has ID as well as ROOT_ID.
If a record's ROOT_ID matches another record's ID, it's a ...
1
vote
2
answers
32
views
Levenshtein distance algorithm without delete operation
I modified Levenshtein distance algorithm form geeksforgeeks using full matrix. I deleted a delete operation (prevRow[j]) and it works now well only for specific order of input string.
cout << ...
2
votes
1
answer
67
views
networkx finding shortest path in edge label order
I work for an airport, and my task is to calculate the taxiing routes for airplanes on taxiways, ensuring they follow the prescribed road sequence. Here, I'll give an example and would like to ask if ...
0
votes
0
answers
51
views
sorting algorithm in x86 assembly
i know the code for this is bad and not close to working but i dont know what to do at all
im supposed to get the lowest value in the array and then swap it to the first spot and then get the second ...
1
vote
1
answer
73
views
Have I written these sha256 #define's the correct way?
here are they:
#define majority(a, b, c) _mm256_xor_si256(_mm256_xor_si256(_mm256_and_si256(a, b), _mm256_and_si256(b, c)), _mm256_and_si256(a, c))
#define choose(e, f, g) _mm256_xor_si256(...
3
votes
2
answers
86
views
Efficient algorithm that returns a list of unique lists given a list of of lists as input
Given a python list of lists containing numbers i.e lists = [ [1, 2], [2, 1], [3, 4] ], the problem is to return a list of all unique lists from the input list. A list is considered a duplicate if it ...
1
vote
0
answers
57
views
Are there any algorithms that allow quick/efficient lookup of hexes based on location on a large subdivided hex/pentagon tiled icosphere?
So, I have a subdivided icosahedron sphere (icosphere), and I am looping through its vertices and creating a logical tile-map of hexagons at the location of every vertex in the array. Basically, now I ...