i'm looking for an algorithm to check if all the bytes in a stream or buffer are equal. exist any algorithm to test that?
I know wich this problem can be solved by walking across the stream and comparing each element with the first element, but I am looking for a better solution. the stream can have thousand of elements.
...
I am trying to calculate 3D shapes out of a 3 dimensional matrix of samples. My idea is that I would have a 3 dimensional matrix of data points, with each corresponding location in (X, Y, Z) space, and from this I would determine a set of 3 dimensional shapes in the (X, Y, Z) space that each outline data points of similar values. Somethi...
I have a list of products {P1, P2, ...} each of which can have a list of attributes {a1, a2, ...}. What's the fastest algorithm to find all elements NOT having some attributes say {a2, a6, a10}?
If
P1 = {a1, a2, a3}
P2 = {a3}
P3 = {a1, a4}
, the algorithm should return {P2, P3}
The issue is I don't know the input list of attributes ...
I have the following incoming value:
variants = {
"debug" : ["on", "off"],
"locale" : ["de_DE", "en_US", "fr_FR"],
...
}
I want to process them so I get the following result:
combinations = [
[{"debug":"on"},{"locale":"de_DE"}],
[{"debug":"on"},{"locale":"en_US"}],
[{"debug":"on"},{"locale":"fr_FR"}],
[{"debug":"off"},{...
I'm searching for an certain object in my photograph:
Object: Outline of a rectangle with an X in the middle. It looks like a rectangular checkbox. That's all. So, no fill, just lines. The rectangle will have the same ratios of length to width but it could be any size or any rotation in the photograph.
I've looked a whole bunch ...
Hello!
I need to find the complexity of finding all the cycles in a undirected graph consisting of 50 nodes. Moreover, if the graph grows large, will the complexity be changed and what will be it if the network grows considerably large. In addition, if I find only few cycles then how do I find the complexity of finding few cycles in a g...
Say I have two sequences of numbers, A and B.
How can I create an object to describe the relationship between the two sequences?
For example:
A: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9...
B: 0, 2, 4, 6, 8, 10, 12, 14, 16, 18...
B = 2A
The relationship, f() is how we get from A to B.
But given two arbitrary sequences, how can I construct...
I found this sweet code here:
http://geeksforgeeks.org/?p=767
the source link: http://mathworld.wolfram.com/Permutation.html
ok how do I even begin to understand these codes?
how do I start coding like this?
I have encountered many such codes...using dynamic programming, backtracking, branch and bound...and understood squat.
even if u ...
I'm looking for a data structure with which I can find the most frequently occuring number (among an array of numbers) in a given, variable range.
Let's consider the following 1 based array:
1 2 3 1 1 3 3 3 3 1 1 1 1
If I query the range (1,4), the data structure must retun 1, which occurs twice.
Several other examples:
(1,13) = 1
(...
Given a weighted graph (directed or undirected) I need to find the cycle of the graph with the maximum weight.
The weight of a cycle being the sum of the weight of the edges of the graph.
It can be any cycle, not just base cycle for which we can
find all base cycle (see http://stackoverflow.com/questions/1607124/algorithms-to-identif...
does gcd(gcd(a,b),gcd(c,d)) equal gcd(a,b,c,d)?or how can i calculate gcd of 4 number?
...
I am writing a very process-intensive function in PHP that needs to be as optimized as it can get for speed, as it can take up to 60 seconds to complete in extreme cases. This is my situation:
I am trying to match an array of people to an XML list of jobs. The array of people have keywords that I have already analyzed, delimited by spac...
I have gone through one of the books of algorithm and I have found a problem named Hiring Problem. Here is the situation
I have to conduct a interview for hiring the candidates for my company.
I am personally not able to conduct the interview as I have failed to do so.So I have hired a employment agency for hiring the candidate.The agen...
I have any sequence (or sentence) and i want to extract the last 2 strings.
For example,
sdfsdfds sdfs dfsd fgsd 3 dsfds should produce: 3 dsfds
sdfsd (dfgdg)gfdg fg 6 gg should produce: 6 gg
...
I have a method that swaps two items:
swap( collection['a'], collection['b'] ); // result = 'b', 'a'
swap( collection[0], collection[1] ); // result = collection[1], collection[0]
swap( 0, collection.indexOf(collection[1]) ); // result collection[1] index, 0
The swap method cannot be modified.
Four possible values stored in a coll...
Are there known algorithms or a good approach to aging a person's photo?
Assuming you know the position of eyes/nose/mouth/shape of head what techniques exist to age someone's portrait?
For the iPhone, there are apps like AgingBooth and AgeMyFace, and I was wondering how they accomplished that.
...
Disclaimer: I'm a total newbie at graph theory and I'm not sure if this belongs on SO, Math SE, etc.
Given 2 adjacency matrices A and B, how can I determine if A and B are isomorphic.
For example, A and B which are not isomorphic and C and D which are isomorphic.
A = [ 0 1 0 0 1 1 B = [ 0 1 1 0 0 0
1 0 1 0 0 1 1 0 ...
Hello,
(First of all, sorry for my english, it's not my first language)
I have a list of tasks/jobs, each task must start after a specific start time, needs to run for a certain time and has to be finished after a certain end time.
I can dynamically add and remove workers, so it is possible to execute 2 or more tasks at the same time...
Hi,
My friend and I are working on a project for distributed KD-tree with applications to location-aware services in mind.
Can anyone point us to papers related to this?
Thanks
...
I've to write a weighted load balancing algorithm and I'm looking for some references. Is there any book ? that you can suggest to understand such algorithms.
Thanks!
...