473,398 Members | 2,404 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,398 software developers and data experts.

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(corresponding 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,example :
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 6931
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(corresponding 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,example :
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
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...
36
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
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...
6
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...
4
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...
8
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...
9
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...
4
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...
7
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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
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...
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,...

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.