473,662 Members | 2,596 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Permutation for Web application

1 New Member
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 1034

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

Similar topics

10
5619
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 = lst for x in permute( lst ): yield head + x
3
7129
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 zeroes. Is there an algorithm for matrixes that is optimized just for permutations? The matrices that I use are fairly small (around 6*6) and I only use positive integers as elements. Thanks for help,
1
623
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
3579
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), (1,3,2), (2,1,3), (2,3,1), (3,1,2), (3,2,1).
27
6505
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
3128
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 number, e.g.
6
11741
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 that will randomly generate 10 unique random numbers. Your job is to write a program that produces random permutations of the numbers 1 to 10. “Permutation” is a mathematical name for an arrangement. For example, there are six permutations of the...
7
4082
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 those examples cannot compute n selection from m elements. They only able to computer permutation of m elements without selection e.g. 4P4. Hence i need guideline in how to compute this kind of permutation. If i use manual calculation of 4P3...
0
1486
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 should say that phrase 1 is permutation of phrase 2. Note that spaces/tabs are not counted as characters. Sample Input: 3 One World One Dream World One One Dream No World No Dream Sample Output: Phrase 1 is permutation of Phrase 2
2
7317
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 correct method string to turn off the text replace "feature." I am not talking about the "Track Name AutoCorrect Info" method, but rather the method that corresponds to the checkbox if one were to enter Access 2010 and click File, Options,...
0
8435
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8768
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8547
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7368
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5655
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.