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.
-1
votes
2answers
29 views
Explination of Mersenne Twister algorithm
I am looking to implement the Mersenne Twister random number generator in a project. However, since this is for an embedded application, I will be later optimizing the code for my architecture. ...
2
votes
0answers
22 views
Creating a stitched scene using glFrustum
I have a program in which I can make a scene render on a screen as per the user's position. As the user changes position, the frustum changes to give off-axis projection. I want to utilize the ...
0
votes
8answers
118 views
Divisiblity of 5 without using % and / operator [closed]
how to check whether a number is divisible by 5 or not without using % and / operator.
I want a quickest algorithm for this problem.
1
vote
5answers
90 views
Multithread C++ program to speed up a summatory loop
I have a loop that iterates from 1 to N and takes a modular sum over time. However N is very large and so I am wondering if there is a way to modify it by taking advantage of multithread.
To give ...
5
votes
5answers
45 views
How can I find the center of a cluster of data points?
Let's say I plotted the position of an airplane every day for the past year and came up with the following map:
Any human looking at this would be able to tell me that this airplane is based out of ...
0
votes
0answers
38 views
Strange execution time results - comparing bubble and shell sort
I'm comparing execution times of bubble sort and Shell sort. The second obviously should be quicker, so let's see:
time_start(); for(int i = 0; i < 100000; i++) numbers = shell(numbers); ...
2
votes
3answers
59 views
A variation of “How to find the maximum area of a rectangle given its perimeter” with Python
I have an optimization problem with the following mathematical model. It is similar to finding the maximum area of a rectangle given its perimeter but in this example we don't have 2 variables.
I ...
0
votes
1answer
14 views
kadane algorithm - any order constraints on input?
I apologize if I have missed some assumption about the input but doesn't this algorithm fail for input like {2, -3, 1} ?
When processing -3, the currentSum gets 2+ (-3) = -1 and currentStartIndex ...
7
votes
2answers
91 views
Maximize resource utilization given multiple types of resources and specific mixtures of resources per task
Given
You have some very large number of possible tasks, each of which requires the use of some subset of possible resources from a large number of possible resources.
Each task has an associated ...
0
votes
2answers
44 views
String Matching: Matching words with or without spaces
I want to find a way by which I can map "b m w" to "bmw" and "ali baba" to "alibaba" in both the following examples.
"b m w shops" and "bmw"
I need to determine whether I can write "b m w" as ...
1
vote
2answers
28 views
Best way to find the most costly path in graph
I have a directed acyclic graph on which every vertex has a weight >= 0. There is a vertex who is the "start" of the graph and another vertex who is the "end" of the graph. The idea is to find the ...
1
vote
1answer
37 views
Number of edges between the two subsets of a bipartitioned graph
Given a graph G=(V, E), a subset S that belongs to V, and the subset S' containing every vertex of G not belonging to S, I want to count the total number of edges between the nodes of S and S'.
An ...
4
votes
1answer
38 views
Converting ISBN10 to ISBN13
I have tried to convert ISBN10 codes to ISBN13 numbers with Java. From . On isbn-13.info I found the way to convert them.
Example: 0-123456-47-9
Begin with prefix of “978”
Use the first ...
4
votes
1answer
65 views
Find numbers having a particular difference within a sorted list
Given N sorted numbers, we need to find, if there exists a pair, with difference K.
A O(N log N) solution is to check for every number x , check if (x + K) exists using binary search.
I was ...
2
votes
1answer
41 views
Draw multiple views of scene on single screen
I have a class for projection in OpenGL, which a user can use as follows:
//inside the draw method
customCam1.begin();
//draw various things here
customCam1.end();
The begin and end methods in ...