So for example I have such lines with coordinates. how (using what algorithm) is it possible to generate some kind of simple 3d scene meaning get relative distance from camera to the wall that is facing us?
...
I'm looking for a quick method/algorithm for finding which nodes in a graph is critical.
For example, in this graph:
Node number 2 and 5 are critical.
My current method is to try removing one non-endpoint node from the graph at a time and then check if the entire network can be reached from all other nodes. This method is obvious not...
Hello all,
I'm implementing a few graph algorithms at the moment and am wanting a container with the complexity of a fibonacci heap or a relaxed heap (specifically I want at least O(logN) for push and pop and O(1) for reduce_key).
I'm not keen on implementing this myself if at all possible (development and testing overhead and time) an...
Sometimes it's simple enough (if the self call is the last statement, it's tail recursion), but there are still cases that confuse me. A professor told me that "if there's no instruction to execute after the self-call, it's tail recursion". How about these examples (disregard the fact that they don't make much sense) :
a) This one sho...
The sequence goes like this.. 7,8,77,78,87,88,777,778,787,788 and so on..
What can be the logic for finding the nth number of the sequence? I tried that by dividing it by 2 and then by 4 and hence, but it doesn't seem to work.
...
I have some code that calculates the lowest common multiple for a list of numbers. I would like to modify this code to return a list of values that represents the lowest common multiple for each pair in my number list.
def lcm(numbers):
return reduce(__lcm, numbers)
def __lcm(a, b):
return ( a * b ) / __gcd(a, b)
def __gcd(a,...
What would be the best way to optimize this code below to make it more efficient while applying the 'best practices'. This is just a simple school project and it works, I've tested it. But I just feel like there's a better and more efficient way to write this method. What do you think?
I have an array that
is pre-populated with a bunch...
Can someone please either confirm or correct this Wikipedia algorithm for computing the first principal component? I want a simple implementation of PCA in D, which doesn't have any existing libraries for PCA AFAIK. I've tried implementing this, and it doesn't seem like my results on simple examples match stuff I get from R or Octave. ...
Given an array of pointers to ordinary C NUL-terminated (and typically very long) strings, how can we best find the smallest and the largest strings?
...
I have a std::set which is of type point
struct point
{
int x;
int y;
int z;
};
Suppose I want to perform three different operation on each variable in set i.e
Find the smallest number from x variables.
Get missing elements from y variables
using set difference.
Get product of all z variables.
At this point, should i use thr...
The problem
I am trying to improve the result of an OCR process by combining the output from three different OCR systems (tesseract, cuneinform, ocrad).
I already do image preprocessing (deskewing, despeckling, threholding and some more). I don't think that this part can be improved much more.
Usually the text to recognize is between on...
No matter how I try, I can't seem to create a nice and clean algorithm for doing the following:
System.Array (or generic List) data of System.Object
System.Array (or generic List) xval of System.Object
System.Array (or generic List) idxs of System.Int32
xval and idxs contain the same number of elements and idxs contains no values les...
Given an array A of N nonnegative numbers, I'm interested in finding the number of ways you can pick 5 numbers (from distinct positions in the array) such that their sum is S.
There is an easy solution in O(N^3):
Let H be a hash table of (sum, position of leftmost element of sum)
for i = 0, N
for j = i + 1, N
H.add(A[i] + A...
Anybody has idea on how desktop search algorithm is implemented. Any starting point would be helpful.
...
I need to sort a huge list of text strings of arbitrary length. I suppose radix sort is the best option here. List is really huge, so padding strings to the same length is completely impossible.
Is there any ready-made implementation for this task, preferably in C#?
...
Hi guys,
Currently, I am working on a project that is trying to group 3d points from a dataset by specifying connectivity as a minimum euclidean distance. My algorithm right now is simply a 3d adaptation of the naive flood fill.
size_t PointSegmenter::growRegion(size_t & seed, size_t segNumber) {
size_t numPointsLabeled = 0;
/...
We have two lists, let's say students and their scores. I want to compare these two lists and find the delta between the new list and the old list, then find the least intrusive way to Insert or Update into the new list any changes. What is the best algorithm to approach this? Want to focus on minimal amount of changes to new list and...
I have a SQL table with three columns X, Y, Z. I need to split it in groups in such a way that all records with same value of X or Y or Z are assigned to the same group. I need to make sure that the records with same value X or Y or Z are never split across multiple groups.
If you think of records as nodes and values of X, Y, Z as edges...
Possible Duplicate:
An algorithm to decompose a whole number into all possible sets of whole numbers that sum to it.
An algorithm which for any input positive integer, gives all possible distinct arrays of positive non-zero integers that can sum to it.
e.g Inputting 4 returns (1,1,1,1), (1,1,2), (1,2,1), (2,1,1), (1,3), (3,1)...
Hello.
I'm very new to C and I decided to make a function called str_replace which replaces strings inside strings which have been made using malloc. It appears to work but can anyone find any room for improvements.
Any advice will be appreciated. I'd like to know if people think finding the number of occurrences to calculate the new s...