473,414 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Permutation for Web application

I have Created a webapplication which displays the combination of inputs supplied.
Expand|Select|Wrap|Line Numbers
  1.                         Permutation<string> permutations = new Permutation<string>(inputSet);
  2.                         foreach (IList<string> p in permutations)
  3.                         {
  4.                             dr = dt.NewRow();
  5.                             dr1 = dt.NewRow();
  6.  
  7.                             if (!string.IsNullOrEmpty(txtFirst.Text) || !string.IsNullOrEmpty(txtSecond.Text))
  8.                             {
  9.                                 dr["Shuffle"] = String.Format("{0} {1}   ", p[0], p[1]);
  10.  
  11.                                 dr["Shuffle"] = dr["Shuffle"] + ", " + txtFirst.Text + " " + txtSecond.Text;
  12.  
  13.                                 dt.Rows.Add(dr);
  14.                             }
  15.                             else
  16.                             {
  17.                                 dr["Shuffle"] = String.Format("{0} {1}  ", p[0], p[1]);
  18.  
  19.                                 dt.Rows.Add(dr);
  20.                             }
  21.                         }
  22.  
  23.  
  24.  
  25.  
  26.                         /////// THREE COMBINATION
  27.  
  28.                         Permutation<string> permutations2 = new Permutation<string>(inputSet);
  29.                         foreach (IList<string> p in permutations2)
  30.                         {
  31.                             dr = dt.NewRow();
  32.                             dr2 = dt.NewRow();
  33.  
  34.                             if (!string.IsNullOrEmpty(txtFirst.Text) || !string.IsNullOrEmpty(txtSecond.Text))
  35.                             {
  36.                                 dr2["Shuffle"] = String.Format("{0} {1} {2}  ", p[0], p[1], p[2]);
  37.  
  38.                                 dr2["Shuffle"] = dr2["Shuffle"] + ", " + txtFirst.Text + " " + txtSecond.Text;
  39.  
  40.                                 dt.Rows.Add(dr2);
  41.                             }
  42.                             else
  43.                             {
  44.                                 dr2["Shuffle"] = String.Format("{0} {1} {2} ", p[0], p[1], p[2]);
  45.  
  46.                                 dt.Rows.Add(dr2);
For two and three combination of names it is displaying but if i try to add for four combination. the combinations are repeating. please help me on this.
May 23 '11 #1
0 1023

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Talin | last post by:
I'm sure I am not the first person to do this, but I wanted to share this: a generator which returns all permutations of a list: def permute( lst ): if len( lst ) == 1: yield lst else: head =...
3
by: Jack Middleton | last post by:
Hi! I'm lookin for a faster permutation algorithm for matrices. I know that it can be done with multiplying a matrix with a permutation matrix. It just seems a waste to iterate through all those...
1
by: user | last post by:
Hello I have Array of 50 ints. I want to receive random permutation, so in each int will be different number from 0-49. Is there any class for permutation ? Thanx Michal
6
by: Rajesh | last post by:
Hello Everybody, Can anybody help me in writing a C program to generate and print all possible combinations of n numbers. For eg. for 3 numbers(1,2,3) there turn out 3! combinations. (1,2,3),...
27
by: onkar | last post by:
How to generate different permutations of n char array? ex : for n= 3, and basic string = abc bca cab bac cab ..... ... ..
3
by: weidongtom | last post by:
Hi, I have been working at this problem, and I think I need a permutation algorithm that does the following: Given a list of elements that are either a character or a character follows by a...
6
by: badcrusher10 | last post by:
Hello. I'm having trouble figuring out what to do and how to do.. could someone explain to me what I need to do in order to work? THIS IS WHAT I NEED TO DO: Professor Snoop wants a program...
7
by: xirowei | last post by:
Let's say i create a String array that store 4 Alphabets {"A","B","C","D"} How can i get the result if i need permutation of 4P3 and 4P2? I had refer to many examples from the internet, but...
0
by: 249740 | last post by:
Write a program that reads N phrases and determines if one phrase is a permutation of the other. For example: Phrase 1 is: “One World One Dream” Phrase 2 is: “World One One Dream”. Then the output...
2
by: Bill Boord | last post by:
I need to be able to shut off the AutoCorrect "feature" within Access 2010 code. I have utilized Application.SetOption with method strings for other startup requirements, but I cannot seem to find a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.