I have a Pandora-like piece of software where the user can thumb up a song or thumb down a song. The software, called Chavah, is Silverlight + C#, but this is a language- and platform-neutral question.
My software needs to choose a song based on the user's preferences. I need a good algorithm for this.
I want my software to choose a so...
I'm a self-taught developer and, quite frankly, am not all that great at figuring out which search or sort algorithm to use in any particular situation. I was just wondering if there was a Design Patterns-esque listing of the common algorithms available out there in the ether for me to bookmark. Something like:
Name of algorithm (with...
Given a collection of integers, what's a Java algorithm that will give combinations as follows..
Given the example collection: [1,3,5], we'd want the output:
[1-1]
[3-3]
[5-5]
[1-3]
[1-5]
[3-5]
Note that ordering is not important, so we want one of [1-3], [3-1] but not both.
This should work with a collection of n numbers, not jus...
Hi,
Having looked around this site for similar issues, I found this: http://math.nist.gov/javanumerics/jama/ and this: http://sujitpal.blogspot.com/2008/09/ir-math-with-java-similarity-measures.html
However, it seems these run in O(n^2). I've been doing some document clustering and noticed this level of complexity wasn't feasible when ...
Hi there,
In these days I'm coding some data structures in Java. Many of them (if not all) offer a very simple interface (add, contains, delete) but under the hood there are non-trivial algorithms.
How can I use the tdd technique in such a situation?
I think that the problem is that tdd (and in general unit testing) is about testing t...
Hi,
I've been having some problems trying to grasp the concept of big O notation. So, by definition big O is as follows, T(n) ∈ O(G(n)) if T(n) <= G(n) * C.
Since the the constant "C" can be any integer > 0, wouldn't this following example be true as well?
Example:
n log n ∈ O(log n)
n log n <= log n * c
Where C is equal to the va...
Hi,
I previously asked a similar question on this topic, I ended up deriving several solutions which worked, one based on bloom filters + ngrams, the other based on hash tables + ngrams. Both solutions perform fine with small data sets (<1000 texts, usually tweets) but the computation time grew exponentially meaning doing 10,000 could t...
given
d0=0
d1=5+3d0
d2=5+3d1
...
dn=5+3dn-1
how would I write the summation for this up to n?
...
A rather specific question, does anyone know an existing piece of code on how to generate solvable levels for the game unblock me? OR what would the best approach to writing my own be? Typically how would you go about writing an algorithm to test and generate solvability and such?
...
How could I implement in C a simple way to generate the 2 missing control points for an elliptic arc given a start and end point? I don't need fancy error estimation, just something that can take points A and D and generate the control points B and C for the elliptical arc where I can then use the cubic bezier interpolation algorithm to ...
Without resorting to asymptotic notation, is tedious step counting the only way to get the time complexity of an algorithm? And without step count of each line of code can we arrive at a big-O representation of any program?
Details: trying to find out the complexity of several numerical analysis algorithms to decide which will be best s...
I want to break a domain name into constituent words and numbers e.g.
iamadomain11.com = ['i', 'am', 'a', 'domain', '11']
How do i do this? I am aware that there may be multiple sets possible, however, i am currently even ok, just getting 1 set of possibilities.
...
1 Begin with a connected graph G containing edges of distinct weights, and an empty set of edges T
2 While the vertices of G connected by T are disjoint:
3 Begin with an empty set of edges E
4 For each component:
5 Begin with an empty set of edges S
6 For each vertex in the component:
7 Add the cheapest edge from...
I have an unsorted array, what is the best method to remove all the duplicates of an element if present?
e.g:
a[1,5,2,6,8,9,1,1,10,3,2,4,1,3,11,3]
so after that operation the array should look like
a[1,5,2,6,8,9,10,3,4,11]
...
I an now learning the Las Vegas and Monte Carlo algorithms myself,and have two questions may be simple but I can not answer them,if someone can help me...Thanks in advance
Consider a Monte Carlo algorithms A for a problem P whose expected runnig time is at most T(n) on any instance of size n that produces a corect solution with probabi...
Hello everybody.
I have experienced AlphaBeta algorithm with my own old chess engine and now i am trying to write new engine and i see that algorithim encounter beta cut-offs but in my opinion, this should never be occur if i don't use narrowed window. Am i wrong ? I am using int.MaxValue for beta and -int.MaxValue for alpha so what ca...
I have an interesting programming puzzle for you:
You will be given 2 things:
1. A word containing a list of english words put together :
word = "iamtiredareyou"
2. Possible subsets:
subsets = ['i', 'a', 'am', 'amt', 'm', 't', 'ti', 'tire', 'tired', 'i', 'ire', 'r', 're', 'red', 'redare', 'e', 'd', 'da', 'dar', 'dare', 'a',...
There is a wonderful problem set called Ninety-Nine Prolog Problems. Problem P70 is the one referred to in the title. And here is a great Prolog solution of this problem which takes only 5 lines. However, my understanding of Prolog is limited.
How does this solution look like in a C-like form (no itertools available)?
Edited by request...
Are there any well-designed, general purpose decision tree implementations for iPhone or Java? I know with LINQ it would be quite trivial, but with Objective C and Java, it would be much more complex.
Basically, I want to drill down a set of objects based off any number of qualifications or attributes in my apps.
...
I'm using VB.NET but any other known language should be fine as long as it uses basic features.
My task is to create astrological compatibility chart, when two users have certain astrological sign as inputs and there is a text about those signs compatibility.
for those who are unaware of astrological signs but still want to help, there...