473,756 Members | 8,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

possible combination of numbers

AAA
hi,
I'll explain fastly the program that i'm doing..
the computer asks me to enter the cardinal of a set X ( called "dimX"
type integer)where X is a table of one dimension
and then to fill it with numbers X[i];
then the computer asks me how many subsets i have (nb_subset type
(integer))
then,i have to enter for every sebset the card, and then to fill it,
we'll have a two tables , one called cardY which contains nb_subset
elements,and every element is the cardinal of every Yi
example:
X={0, 1, 2, 3, 4, 5,6, 7,8, 9, 10} dimX= 11

Y1={5, 8, 9, 7} cardY[0]=4
Y2={2, 0, 7, 6, 4, 10} cardY[1]=6
Y3={8, 10, 6, 4, 3, 1} cardY[2]=6
Y4={9, 7, 5, 3, 1, 10, 7} ...
Y5={3, 8, 1, 9, 6} ...
Y6={1, 2, 3} ...
Y7={4, 9, 6, 3, 0} card[6]=4

and then a table of two dimensions, called TY(correspondin g to Table Y)
which contains all the values of Yi
5 8 9 7 * * *
2 0 7 6 4 10 *
8 10 6 4 3 1 *
9 7 5 3 1 10 7
3 8 1 9 6 * *
1 2 3 * * * *
4 9 6 3 0 * *

(sure i'll lose memory, but its okay) i know that using chained lists
is best , but its okay

now the problem is to find all the combination possible of Yi which is
equal to X
example :

X= {1, 2, 3, 4, 5}
Y1= {2, 4, 5}; Y2= {1, 2, 4} ; Y3= {2, 3, 5} ; Y4= {3, 5} ; Y5= {1, 3,
4}
S= {1, 3, 5} S is a solution, N.B. where 1,3,and 5 are not elements,
but they are the indicies of Y
in this case Y1, Y3 and Y5

this was the subject of my mini project,
now ,my algorithm is to make a table containing all the possible
combinations of the indicies,exampl e :
if the nb_subsets is 3
1
2
3
1,2
1,3
2,3
1,2,3
and then,i bring the Y1 and compare it to X, if the same, i return S=
{1}
if not , i try Y2,
then Y3
then Y1 and Y2 , if Y1 U Y2 = X , then the solution S={1,2}
and i continue

my question that i'd like to have your help in is :
HOW TO MAKE A TABLE OF THREE DIMENSIONS CONTAINING ALL THE POSSIBLE
INDICIIES, like the example above.
i don't know if it is possible,but it is something that i need
urgently,cause i have to give back my work on monday(in less than 2
days)
thanks a lot for your help..
sincerely

Sep 2 '06 #1
1 6957
AAA wrote:
hi,
I'll explain fastly the program that i'm doing..
the computer asks me to enter the cardinal of a set X ( called "dimX"
type integer)where X is a table of one dimension
and then to fill it with numbers X[i];
Since X is a **set** does this mean that the numbers
you have to enter are distinct ?
then the computer asks me how many subsets i have (nb_subset type
(integer))
then,i have to enter for every sebset the card, and then to fill it,
If you know the subset then it automatically determines
its cardinal and its elements. So I don't see why you have
to enter the card and fill it.
we'll have a two tables , one called cardY which contains nb_subset
elements,and every element is the cardinal of every Yi
example:
X={0, 1, 2, 3, 4, 5,6, 7,8, 9, 10} dimX= 11

Y1={5, 8, 9, 7} cardY[0]=4
Y2={2, 0, 7, 6, 4, 10} cardY[1]=6
Y3={8, 10, 6, 4, 3, 1} cardY[2]=6
Y4={9, 7, 5, 3, 1, 10, 7} ...
Y5={3, 8, 1, 9, 6} ...
Y6={1, 2, 3} ...
Y7={4, 9, 6, 3, 0} card[6]=4

and then a table of two dimensions, called TY(correspondin g to Table Y)
which contains all the values of Yi
5 8 9 7 * * *
2 0 7 6 4 10 *
8 10 6 4 3 1 *
9 7 5 3 1 10 7
3 8 1 9 6 * *
1 2 3 * * * *
4 9 6 3 0 * *

(sure i'll lose memory, but its okay) i know that using chained lists
is best , but its okay

now the problem is to find all the combination possible of Yi which is
equal to X
example :

X= {1, 2, 3, 4, 5}
Y1= {2, 4, 5}; Y2= {1, 2, 4} ; Y3= {2, 3, 5} ; Y4= {3, 5} ; Y5= {1, 3,
4}
S= {1, 3, 5} S is a solution, N.B. where 1,3,and 5 are not elements,
but they are the indicies of Y
in this case Y1, Y3 and Y5

this was the subject of my mini project,
now ,my algorithm is to make a table containing all the possible
combinations of the indicies,exampl e :
if the nb_subsets is 3
1
2
3
1,2
1,3
2,3
1,2,3
and then,i bring the Y1 and compare it to X, if the same, i return S=
{1}
if not , i try Y2,
then Y3
then Y1 and Y2 , if Y1 U Y2 = X , then the solution S={1,2}
and i continue

my question that i'd like to have your help in is :
HOW TO MAKE A TABLE OF THREE DIMENSIONS CONTAINING ALL THE POSSIBLE
INDICIIES, like the example above.
i don't know if it is possible,but it is something that i need
urgently,cause i have to give back my work on monday(in less than 2
days)
I'm sure it is possible if you manage to actually explain
what you need to do. So far I ain't got a clue. To be
perfectly honest with you it doesn't look like you can
manage for Monday but we'll see.

Sep 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
8293
by: Chris Lasher | last post by:
Hello, I would like to create a set of very similar regular expression. In my initial thought, I'd hoped to create a regular expression with a variable inside of it that I could simply pass a string into by defining this variable elsewhere in my module/function/class where I compile the regular expression, thus making for an easy substitution. However, still after JFGI'ing, I still cannot find the syntax to place a variable inside a...
36
9477
by: rbt | last post by:
Say I have a list that has 3 letters in it: I want to print all the possible 4 digit combinations of those 3 letters: 4^3 = 64 aaaa
9
2278
by: tony collier | last post by:
i have created a 7-dimensional array which has 19.5 million elements. when i try to create 8-dimensional array i get out of bounds system exception. does anyone know if this limitation is due to amount of memory in my pc or a limiation of c# language? thanks
6
4521
by: aka_eu | last post by:
I have this problem. I'm trying to get all the valid combination C(N,K) that pass one condition. For example C(5,3) can use in any combination this numbers {1,2,3,4,5} But let's say that I have the limitations that these pair of numbers cannot be part of the same combination {2,3} and {4,5}
4
2320
by: kivan.maharaj | last post by:
What I want to do is write a program to test lexicographical combinations of various sets of numbers to a predefined number and write that true values to a text file. Example: Number choosen between 1 and 50 Number set = 6
8
5635
by: Mir Nazim | last post by:
Hello, I need to write scripts in which I need to generate all posible unique combinations of an integer list. Lists are a minimum 12 elements in size with very large number of possible combination(12!) I hacked a few lines of code and tried a few things from Python CookBook (http://aspn.activestate.com/ASPN/Cookbook/), but they are hell slow.
9
1400
by: Andy | last post by:
Hi there, I'm trying to do some predicting work over user input, here's my question: for pattern r'match me', the string 'no' will definitely fail to match, but 'ma' still has a chance if user keep on inputting characters after 'ma', so how do I mark 'ma' as a possible match string? Thanks a lot,
4
7687
by: RSH | last post by:
Okay my math skills aren't waht they used to be... With that being said what Im trying to do is create a matrix that given x number of columns, and y number of possible values i want to generate a two dimensional array of all possible combinations of values. A simple example: 2 - columns and 2 possible values would generate: 0 0
7
1735
by: Mysterydave | last post by:
Hi, I have a table of applications including what someone's applied for, which year, what type of applicant they are, and progress of the application etc. I want to be able to break this down into subject areas and numbers of applications, number of offers per year per type of student etc. It would be nice if this is in a table. I can generate the required counts using queries, but each one is seperate and I would like a table with these...
0
9212
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
9973
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9779
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
8645
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
7186
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
6473
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();...
0
5247
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3742
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
2
3276
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.