Plz, can u give some more description regarding your problem. So, that we can Understand what's the Criteria u want.

my sortedLIst and the code are show below:
(1): 4
(2): 4
(1 2): 3
(3): 4
(1 3): 3
(2 3): 3
(1 2 3): 2

 lbCombinations.Items.Clear();
            int n = txtCaseInputs.Lines.Length;
            for (int k = 1; k <= txtCaseInputs.Lines.Length; k++)
            {
                txtNumCombinations.Text = Combination.Choose(n, k).ToString();
                Combination c = new Combination(n, k);
                string[] result = new string[k];
                while (c != null)
                {
                    result = c.ApplyTo(txtCaseInputs.Lines);

                    StringBuilder sb = new StringBuilder();
                    for (int i = 0; i < result.Length; ++i)
                    {
                        sb.AppendFormat("{0}{1}", result[i], " ");
                    }
                    lbCombinations.Items.Add(sb.ToString().Trim());

                    c = c.Successor();
                }
            }

            Display();
        }   
        private void Display()
        {

            foreach (String sort in lbCombinations.Items)
            {
                if (!(sortList.ContainsKey(sort)))
                {
                    sortList.Add(sort, 1);
                }
                else
                {
                    int Count = (int)sortList[sort];
                    sortList[sort] = Count + 1;
                }
            }

            IDictionaryEnumerator enumerator = sortList.GetEnumerator();
            richTextBox1.Clear();
            while (enumerator.MoveNext())
            {
                richTextBox1.AppendText("(" + enumerator.Key.ToString() + "): " + " " + enumerator.Value.ToString() + "\n");

            }
        }

now my problem is how to extract some itemset from the sortedlist above?
my output should be like this:
(1 2): 3
(1 3): 3
(2 3): 3
(1 2 3): 2

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.