Questions tagged [algorithm]
An algorithm is a sequence of well-defined steps that defines an abstract solution to a problem. Use this tag when your issue is related to algorithm design.
algorithm
121,111
questions
-5
votes
0
answers
41
views
How to calculate CRC32 of strings longer than 3 characters? [closed]
I try to calculate CRC32 of strings as described in this website
In that website, example string is Hi\n which has 3 characters length.
String is converted to binary format and then inverted. Then it ...
0
votes
1
answer
50
views
Dafny simple proof about giving change not working
I want to prove that the following code returns a given amount (money) in 5 and 3 bills/coins:
function sum(ns: seq<nat>): nat
{
if |ns| == 0 then
0
else
ns[0] + sum(ns[1..])
}
...
0
votes
0
answers
30
views
Calculating a list of voxels within multiple overlapping Axis-Aligned-Bounding-Boxes, without looping over the same space
I have a method that returns a list of voxel coordinates within an AABB. Let's say a voxel is 1x1x1 cm, and a bounding box is 2x2x2, then it will return 8 voxels by looping over the dimensions of the ...
1
vote
3
answers
113
views
In-Place Reordering of Doubly Linked List Nodes to Ensure Memory Contiguity
I am working on a program that deals with doubly linked lists that are allocated within a bounded memory region:
constexpr std::size_t numNodes = 15;
Node* block = new Node[numNodes];
I would like to ...
0
votes
0
answers
19
views
Modified accel asc algorithm
I wanted to make an accel asc algorithm that only outputs partitions that only have terms that are smaller than or equal to n. For example: if I want the partitions of 4, and n = 2, the wanted ...
1
vote
2
answers
87
views
Parse every k-element subset of an n-element vector
My goal is to perform an operation on every k-element subset of n elements stored in a vec.
My current approach uses this bit-manipulation to generate integers with k set bits in lexicographic order. ...
2
votes
1
answer
66
views
Having issues calculating APSP for matrix size n >= 4
I'm having issues finding the problem with the following implementation of Floyd-Warshall APSP Algorithm.
Currently working on a vjudge exercise and I'm having issues figuring out what's the problem ...
0
votes
0
answers
25
views
trilateration algorithm for calculation of real time location (flutter app) (BLE beacons used)
I am trying to implement a real-time location system in which I can upload a map (image) and pinpoint certain things such as the location of beacons, destination, and so on. I am trying to calculate ...
-1
votes
0
answers
66
views
How to determine if a node in graph is connected to another node efficiently? [closed]
Now I know some people will suggest DFS or BFS etc etc, but I am looking for other faster approaches. The graph I'm working on has "mixed" directions - some edges are directed but some aren'...
0
votes
0
answers
21
views
DGE Analysis using Limma on DSP GeoMx Data: Handling Multiple ROIs per Core
I am performing differential expression analysis using the limma package on DSP GeoMx data, and I have a question regarding the handling of multiple ROIs per core. Below is a snippet of my sample ...
1
vote
2
answers
47
views
Fast way of detecting outliers in 2D space
I have hundreds of millions of point clouds like the following:
I want to remove outliers 1, 2, 4, 5, 6, 7. The safest bet is to build a minimum spanning tree connecting all the points and remove ...
-1
votes
0
answers
18
views
How to create an algorithm with melody and chords as input, and tight parallel 3 part harmony as output [closed]
After not finding the app I'm looking for and speaking to a friend who programs:
I'm looking to develop algorithmic rules which can be used to program an app such that you input a melody and ...
0
votes
2
answers
123
views
Finding minimum value in given range efficiently
I have function that takes a number n that represents number of servers and another parameter represents a list of requests
Initially servers will hold values 0 of size n.
For each request, requests[i]...
-1
votes
1
answer
68
views
Algorithm help: given n sets of integers and a target integer, find a set of one element from each set that adds to the target integer
I have multiple sets of integers, let's call them K_1 through K_N. Each set is finite and not necessarily the same size. I have a target integer, C.
Is there a way to select one element from each ...
0
votes
1
answer
46
views
Checking a candidate majority element: Does my simplification work with all cases?
Here are the details of the problem:
Given a sorted array arr of N elements.
A majority element in an array of size N is an element that appears more than N/2 times.
The task is to write a function ...