Advertisement
Guest User

Untitled

a guest
May 16th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. import heapq
  2.  
  3. ch = 'ACGT'
  4. k = 7
  5.  
  6. heap = []
  7. heapq.heappush(heap, '')
  8.  
  9. while len(heap):
  10.   seq = heapq.heappop(heap)
  11.   if len(seq) - k + 1 == len(ch) ** k:
  12.     print seq, len(seq)
  13.     break
  14.   for c in ch:
  15.     n = seq + c
  16.     if len(n) < k or n[-k:] not in seq:
  17.       heapq.heappush(heap, n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement