View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jan Lukszo Jan Lukszo is offline
external usenet poster
 
Posts: 1
Default Help on nested loops

Hi!
I would like to get any helpful suggestion how to approach the following
problem. If I have a single string made of the sequence of capital
letters with no spaces, that may be input by user, and would ordinarily
be n characters long, where n=5 to 100 or even more, different each
time. How to create an Excel spreadsheet or an array, containing all
possible combinations of deletions, where deletion spaces would
gradually increase from 1 to n-1, such that the gradually shortet string
would be created, as schematically outlined below:

ABCDEGTWESRADCRFRIEOPTY
ABCDEGTWESRADCRFRIEOPT
ABCDEGTWESRADCRFRIEOP Y '1 DELETIONS, STARTING FROM RIGHT
ABCDEGTWESRADCRFRIEO TY
ABCDEGTWESRADCRFRIE PTY
ABCDEGTWESRADCRFRI PTY
...................................
..................................
ABCDEGTWESRADCRFRIEO Y
ABCDEGTWESRADCRFRIE P Y '2 DELETIONS, STARTING FROM RIGHT
ABCDEGTWESRADCRFRI OP Y ' FIRST AT POSITION 2, 2ND STARTS AT POS.3 etc
ABCDEGTWESRADCRFR EOP Y
.................................................. ...............
.................................................. ...........
ABCDEGTWESRADCRFRIEOP Y
ABCDEGTWESRADCRFRIE Y ' 3 DELETIONS, STARTING FROM RIGHT
ABCDEGTWESRADCRFRI O Y
.................................................. ........
.................................................. .......
A Y ' n-2
DELETIONS, (N-2)TH DELETION AT POSITION 2 FROM LEFT
B Y ' n-2
DELETIONS, (N-2)TH DELETION AT POSITION 1 FROM LEFT

At first I tought of nested loops, but since the lenght of the string
would be different in each case and so would a number of iterations how
to do it? It would probably be n-1 iterations, different each time. Any
alternative to nested loops?

JasL




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!