Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
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 ...
Melvin Brink's user avatar
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 ...
Jonathon Halim's user avatar
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 ...
str8's user avatar
  • 23
-2 votes
3 answers
103 views

How can I print this pattern [closed]

Problem statement: You are given an integer n, representing the side length of a rhombus. Your task is to write a program to print the pattern of the sides and diagonals of the rhombus. INPUT The ...
Prince Kumar Prajapati's user avatar
0 votes
2 answers
90 views

Why does my Delaunay Triangulation using the Bowyer Watson algorithm not work?

I am implementing delaunay triangulation on a random set generated points, making use of the Bowyer Watson algorithm. I seem to be running into a issue where the output seems to be generating way too ...
aemeny's user avatar
  • 21
1 vote
2 answers
167 views

Smallest element after xor

Starting with array of N positive integers, support Q queries. Each query contains a positive integer i. To answer the query, replace each element of the array with the result of xoring it with i, ...
user25680598's user avatar
1 vote
1 answer
95 views

Why does the sliding window algorithm not work for this problem statement?

The question is regarding an algorithm which I'm using to solve a problem. The problem statement is: (or view it here) "Given arrival and departure times of all trains that reach a railway ...
BlazeRod11's user avatar
1 vote
1 answer
156 views

Thread pool design

I have a design question about thread pool. Consider the following code: int main() { auto po = std::execution::par_unseq; // If Parallel STL uses TBB as the backend, I think the thread pool /...
user2961927's user avatar
  • 1,654
1 vote
1 answer
87 views

Determine which elements of sequence A can be used to create given sequence B in linear time

Let's say we have sequence A and subsequence of A, called B. I need to determine which elements of sequence A could be potentially used to construct subsequence B. For example, assume A = [1, 3, 2, 1, ...
Szyszka947's user avatar
1 vote
1 answer
104 views

Reversing characters of string of parenthesis to achieve at max H string depth

Given a integer H and string s which contains only ( and ) characters, and is properly formed (every opening bracket has corresponding closing bracket, the pairs of brackets are properly nested), ...
Szyszka947's user avatar
0 votes
0 answers
41 views

Why use two arrays of insertion_time and lowest_insert_time in Tarjans algorithm for Bridges in Graph? [duplicate]

I've been working on the LeetCode problem 1192. Critical Connections in a Network. From various sources, I have the following code: class Solution { int timer = 1; void dfs(int node, int ...
Nikhil Garg's user avatar
2 votes
0 answers
79 views

What is the Time Complexity of a function if there is an upper limit to the variable

I have the following piece of code. void foo(int n){ n=n*n; for (int i=0;i<n;i++){ if(n<10) cout << i; else break; } } Now I wanted to ask if the time complexity ...
Muhammad Taha Ali's user avatar
0 votes
3 answers
185 views

Isn't there any more efficient solution for the CodeForces 919-B/Perfect Number question?

So, here's the question: We consider a positive integer perfect, if and only if the sum of its digits is exactly 10. Given a positive integer k, your task is to find the k-th smallest perfect ...
BugHunter's user avatar
2 votes
1 answer
74 views

How to get the first value greater than x in a range with segment tree

I am trying to use a segment tree to handle queries (in O(log N) per query) of the form: find the first value > x in a particular range [ql, qr] (of an array of size N). I've been using the ...
Tizio's user avatar
  • 23
0 votes
1 answer
83 views

While finding count of points inside some shape using KD-Tree, do we need to check areas intersection, or just compare depth-appropriate properties?

Let's say we have to find count of points inside some shape in 2D plane. We can use KD-Tree to solve this. The KD-Tree will partition 2D plane into rectangles, and then we can check intersections ...
Szyszka947's user avatar

15 30 50 per page
1
2 3 4 5
844