Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default Palindromes and repeats

On Oct 29, 2:08*pm, Luciano Paulino da Silva
wrote:
Dear John,
I performed the folloing input string:
GQGAGQGAGAAAAAAGGAGQGGYGGLGNQGAGRGGQGAAAAAAGGAGQGG YGGLGSQGAGRGGLGGQGAGAAAAA*AGGAGQGGYGGLGGQGAGQGAGQG GYGGLGIQGSGRGGLGGQGAGAAAAAAGGAGQGGLGGQGAGQGAGAAAAA A*GGVRQGGYGGLGSQGAGRGGQGAGAAAAAAGGAGQGGYGGLGGQGVGR GGLGGQGAGAAAAGGAGQGGYGGVGSG*ASAASAAASRLSSPQASSRVSS AVSNLVASGPTNSAALSSTISNVVSQIGASNPGLSGCDVLIQALLEVVSA LIQ*ILGSSSIGQVNYGSAGQATQIVGQSVYQALG


[snip]

Dear Luciano,

The purpose of sub Display() was not to replace Main() - it was simply
to show what sort of data Initialize() was collecting since you
indicated that you couldn't figure out what that subroutine was doing
(which isn't surprising since I made little effort to comment the code
and the algorithm is somewhat invovled). If you find the output of
Display() confusing then it is maybe more trouble than it is worth. I
wrote it mostly for myself for debugging purposes anyway. You can
delete it from the project with no ill-effect.

If you want to understand the output a bit more, consider the
following bit:

[snip]

18 * * *9 * * * AGA * * 3 * * * 8 * * * 10
19 * * *9.5 * * 2 * * * 0 * * * 10 * * *9
20 * * *10 * * *A * * * 1 * * * 10 * * *10
21 * * *10.5 * *AA * * *2 * * * 10 * * *11
22 * * *11 * * *AAA * * 3 * * * 10 * * *12
23 * * *11.5 * *AAAA * *4 * * * 10 * * *13
24 * * *12 * * *AAAAA * 5 * * * 10 * * *14
25 * * *12.5 * *GAAAAAAG * * * *8 * * * 9 * * * 16
26 * * *13 * * *AAAAA * 5 * * * 11 * * *15
27 * * *13.5 * *AAAA * *4 * * * 12 * * *15
28 * * *14 * * *AAA * * 3 * * * 13 * * *15
29 * * *14.5 * *AA * * *2 * * * 14 * * *15
30 * * *15 * * *A * * * 1 * * * 15 * * *15
31 * * *15.5 * * * * * *0 * * * 16 * * *15


[snip]

AGA is a plaindrome of length 3 which runs from string position 8 to
10. It is thus centered at 9 = 18/2

GAAAAAAG is a palindrome of length 8 which extends from 9 to 16.
Unlike AGA, it has no middle character. Instead, the "center" of the
palindrome falls between GAAA and AAAG, which I refer to as position.

Don't worry about this output too much. It is probably a better use of
time to give Main() a battery of tests. On the other hand, if either
you or someone on your team is going to maintain or modify the code,
then I could try to write up a brief description of the algorithm and
comment the code more.

Sorry for any confusion.

-John
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Palindromes and repeats Luciano Paulino da Silva Excel Programming 0 October 23rd 09 02:22 AM
Macro for detect palindromes and repeats in letters/numbers string Luciano Paulino da Silva Excel Worksheet Functions 33 April 16th 09 04:59 PM
Macro for detect palindromes and repeats in letters/numbers string Luciano Paulino da Silva New Users to Excel 5 April 14th 09 08:44 PM
Macro for detect and list palindromes and repeats in letters/numbersstring Luciano Paulino da Silva Excel Programming 5 April 14th 09 05:54 PM
Macro for detect palindromes and repeats in letters/numbersstring Luciano Paulino da Silva Excel Programming 0 April 14th 09 05:33 PM


All times are GMT +1. The time now is 11:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"