mình sử dụng Winform để mô phỏng thuật toán sắp xếp selection.
khi thực hiện sắp xếp thì các button thực hiện sx đúng.
Còn các biến I, J để mô phỏng vòng lặp for chạy không đúng,
Giúp mình sửa với[IMG]images/smilies/Surprised.gif[/IMG][IMG]images/smilies/Surprised.gif[/IMG]
đây là phương thức Selection
Mã:
 public  void SelectSort(Node[] node,int length_array_Node,RichTextBox richtextbox,Cmp compare, CmpLbl comparelbl1, CmpLbl comparelbl2, Label lbl1, Label lbl2)
        {
            for (int i = 0; i < length_array_Node -1; i++)
            {
                // cái này để tạo lable, sd delegate để tạo , nó nằm bên Node.cs
               // ứng với mỗi giá trị của i thì lại có 1 cái lable dc tạo ra
               
               comparelbl1(lbl1 , node [i].button .Left , node[i].button .Top +60);
                //Thread.Sleep(100);
               
               for (int j = i+1; j < length_array_Node; j++)
                {
                    comparelbl2(lbl2, node[j].button.Left, node[j].button.Top - 60);
                    //Thread.Sleep(100);
                    if (compare(node [i], node[j]))
                    {
                        
                        reset(node, node[i], node[j]);
                        Thread.Sleep(100);
                    }
                }

               // fun.outputtdata(node, length_array_Node, richtextbox);

            }
        }

Code đây