AllExperts > VB Script 
Search      
VB Script
Volunteer
Answers to thousands of questions
 Home · More VB Script Questions · Answer Library  · Encyclopedia ·
More VB Script Answers
Question Library

Ask a question about VB Script
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Miguel Zapico
Expertise
I can answer question about how to use scripts to consolidate data, connect different systems and automate tasks. I have no experience on using VBScript on web programming.

Experience
I have been using VBScript and Windows Scripting Host as my swiss tool for the last 6 years.

Organizations
New York PC users group (NYPC)
Independant Computer Consultants Association (ICCA)

Education/Credentials
Microsoft MCSE in Windows NT

 
   

You are here:  Experts > Computing/Technology > Basic > VB Script > An algorithm for generating unique number sequences

VB Script - An algorithm for generating unique number sequences


Expert: Miguel Zapico - 8/23/2006

Question
An algorithm for generating unique number sequences from a given set of numbers. eg.
Set {7, 3} the output should be as follows
{7}, {3},
{7 3}, {3 7}
Set {5, 2, 9} the output should be as follows
{5}, {2}, {9},
{5 2}, {2 5}, {5 9}, {9 5}, {2 9}, {9 2},
{5 2 9}, {5 9 2}, {2 5 9}, {2 9 5}, {9 5 2}, {9 2 5}
and more if i have missed...
I need it purely for academic purpose.

Answer
There is an example that can be useful in:
http://j-walk.com/ss/excel/tips/tip46.htm

The algorith only covers the permutations of all the elements, not the generation of the other levels, but it can give an idea on the algorithm used.

Other example with lottery numbers and a different algorithm can be found at:
http://www.experts-exchange.com/Applications/MS_Office/Excel/Q_21405886.html

Hope this helps,
Miguel.

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.