hey...i trying to pass the data from Combination class to sorted list and display result from the sorted list?

I had been try for many times but the result is not right? Could someone can help me?

Recommended Answers

All 4 Replies

Since the items are returned in lexical order (first one is first, second is second), if you sort the items before you pass it to the combination class (if you are using the one I designed), the results will be in sorted order. So if you have myArray as your array:

Array.Sort(myArray);
Combination<myArrayType> c = new Combination<myArrayType>(myArray, n);

Since the items are returned in lexical order (first one is first, second is second), if you sort the items before you pass it to the combination class (if you are using the one I designed), the results will be in sorted order. So if you have myArray as your array:

Array.Sort(myArray);
Combination<myArrayType> c = new Combination<myArrayType>(myArray, n);

but my problem need me to use SortedList to solve it. Now, I face some problem. First, how to read the result which is in sb.ToString() into the SortedList. Second, how to use that SortedList to count the value for each key.

for example:

key value
{1 2}: 1
{1 3}: 2

now i got my Key in sb.toString()
{1 2}
{1 3}
{1 4}
{2 3}
......

So, how to read that sb.toString() into the SortedList and count the value for each key?

Are each of the lines in your StringBuilder in one string or each has their own?

each of lines have their own....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.