Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Given T={CTAGC, GAGCG, AGCGG, CGGAG}, using a greedy algorithm, the superstring S will be CTAGCGGAGCG.

From S, the combination of triplets will be given as s = {CTA, TAG, AGC, GCG, CGG, GGA, GAG, AGC, GCG}.

Both GCG and AGC are repeated.

If using s to retrieve the superstring by using Hamiltonian method, would the repeated words will be used or omitted?

If the repeated word is omitted, then CTA, TAG, AGC, GCG, CGG, GGA, and GAG constructed back will become GTAGCGGAGC.

So, in the end, both the greedy method and Hamiltonian method will provide different results in the superstring.

Why are they different? In my research, all the examples I found showed that there are no repeated words in the combination, so if I reconstruct the superstring using the Hamiltonian method, the result of the greedy and Hamiltonian methods will be the same. But what about the repeated words?

share|improve this question
    
Conceptual algorithm questions are on-topic here: I just cleaned up your question a little bit. –  user8 Oct 11 '11 at 15:14
7  
@MarkTrapp - surely there's a GreedyVsHamiltonian.stackexchange.com site by now. –  Joel Etherton Oct 11 '11 at 15:21
add comment

1 Answer

I didn't quite know the exact algorithm that expresses Super string S from the set T However here is a short answer to your question.

Basically, greedy optimization (or search) algorithm returns after they find first minimum. Thus, they are fairly dependent on the starting point and the nature of the function. On the other hand, Global optimization algorithms tend to search the entire possible space to find the minima across the space. When the search space is minimum, or convex by nature the result of both the type of algorithm is same because there is only 1 minimum. However, if there are many local minima then the global optimization algorithm will search the correct one, whereas the greedy algorithm may produce a sub-optimal result.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.