Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 14th, 2005, 02:06 PM
Dud Bug Dud Bug is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 1 Dud Bug User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 51 sec
Reputation Power: 0
Question This should be easy ...

I would like to list all the ways in which the following can be rearranged:

A B C D E

That is, I would like the program to list all the combinations/permutations, or whatever (i.e. ABCDE, ABCED, ABDCE etc.).

If this was all I wanted to do then it should be easy to solve via five nested For...Next loops.

But there is an added factor. I do not know in advance whether the number of letters will be 5, 6 (e.g. ABCDEF), 10 (e.g. ABCDEFGHIJ) or any other number. I did not think that this would make the problem more difficult, but I cannot see how to generate a code to deal with this.
Any suggestions gratefully received.

Reply With Quote
  #2  
Old February 15th, 2005, 10:59 AM
mvagh2 mvagh2 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 324 mvagh2 User rank is Corporal (100 - 500 Reputation Level)mvagh2 User rank is Corporal (100 - 500 Reputation Level)mvagh2 User rank is Corporal (100 - 500 Reputation Level)mvagh2 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 16 h 26 m 36 sec
Reputation Power: 5
Hi,

Don't have time to write out the entire code, but I'd suggest a recursive procedure. As permutations are inherently defined recursively, this shouldn't be too hard. Mind the stack though, recursion tends to exhaust the stack very rapidly.

Your five nested For..Next's are basically a recursion too, but with a predetermined number of recursions.

Rgrds,

Michiel

Reply With Quote
  #3  
Old February 15th, 2005, 02:34 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 19 m 36 sec
Reputation Power: 181
First you need to define the ground rules. Are you working only with capitalized alphabetic characters, or will other characters be involved. The "universe" of allowable characters will determine how many steps are needed in your loop for each column.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #4  
Old February 19th, 2005, 08:41 AM
blater blater is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 5 blater User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 52 sec
Reputation Power: 0
i have added some program wich i wrote earlier. hope it helps.
Attached Files
File Type: zip word generator.zip (2.3 KB, 124 views)

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > This should be easy ...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT