Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
@MarkTrapp - surely there's a site by now. – Joel Etherton Oct 11 '11 at 15:21

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

Your Answer


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.