All Questions
6,096
questions
0
votes
4
answers
97
views
Why is multiplication of integer O(n^2)?
I was wondering why multiplication of integers is O(n^2)? I've been taught addition and multiplication is considered 1 operation. Hence if I multiply an integer of n-digits with another integer of n-...
-2
votes
1
answer
44
views
Given a number N find the number just smaller than N such that it has a given digit x present in it x times [closed]
You will receive an input number N in string format and also a number x. Your task is to find the largest number that is smaller than N and contains the digit x exactly x times.
For example: N = ...
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 ...
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 ...
5
votes
3
answers
218
views
Multiplication of huge massive of numbers in python
I'm working on a small python program for myself and I need an algorithm for fast multiplication of a huge array with numbers (over 660 000 numbers, each is 9 digits). The result number is over 4 ...
2
votes
0
answers
55
views
Most efficient way of determining if a subgraph of a graph is connected
Suppose I have a graph given by a Laplacian matrix $L$ corresponding to a regular discretization of $[0,1]^2$, meaning nodes $I={(i,j),\quad i,j=1,\dots,n}$ are connected with $(i+1,j),(i,j+1),(i-1,j),...
0
votes
1
answer
53
views
How to Rewrite a Polynomial as a Sum of Two Squares Using Python? [closed]
I need help rewriting the following algebraic expression using Python
Given the input expression:
x**2 - 2*x*y + 2*y**2 + 2*x - 10*y + 17
The output should be the sum of two squares:
(x - y + 1)**2 + ...
2
votes
4
answers
67
views
Find the smallest polygon with a certain edge on a 2d dijkstra graph
Sorry for bad English.
It's somehow called Minimal Cycle Basis of graph algorithm.
I'm currently working on some algorithm to seperate a graph into rooms. Like the example.
I have a graph link like ...
1
vote
0
answers
81
views
Integer solutions for equation with approximated real variable
I'm trying to solve an equation of the kind:
f1(x)*m^2 + f2(x)*m*n + f3(x)*n = 0.
f1, f2, f3 are known linear functions with rational coefficients, x is inside the closed known interval [x_0, x_1] of ...
1
vote
2
answers
49
views
Graph traversal algorithm: when it is possible to move to the next node only after having visited it earlier with all incoming edges of the graph
There is a graph that consists of vertices (industrial installations) and edges flows of raw materials, intermediates and products between this nodes.
I need some kind of algorithm for "...
2
votes
2
answers
105
views
How to locate the most sparse point within a defined 2D region?
The core of the problem is to algorithmically determine the coordinates of the point E that maximizes the distance to the nearest other point in the bounded 2D space.
For example, in the space defined ...
1
vote
2
answers
73
views
Discrete mathematics: Simulate the probability question [duplicate]
Problem
There are 1, 2, 3, 4 number card in a bag.
If you pick up 1, add one white ball into box_b.
If you pick up 2 or 3, add one white ball and one balck ball into box_b.
If you pick up 4, add two ...
3
votes
1
answer
165
views
How do you represent quaternion rotations in 2 dimensions?
I'm developing in Android Studio Java with two Bluetooth IMUs that give quaternions. The sensors are oriented in the following way to start:
In the image shown, this is considered the “zero” position....
2
votes
3
answers
95
views
Extract the closest two numbers that multiply to create a given number
I made a CPU based raytracer in PyGame which uses a tile per thread to render each section of the screen. Currently I divide the screen vertically between lines, this doesn't give me the best ...
2
votes
2
answers
92
views
Creating a short, d-dense list of points on the sphere S^4 in Python
I am a mathematician and this is my first time using Stack Overflow, sorry if the question is not adequate or there is some better place to ask this. I would like to know if there is a standard way ...