Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi all,

can anyone told me that Kind of sort is it below:

C#
string[] data = listbox1.Items.Cast<string>().ToArray();

          ArrayList arr = new ArrayList();

          foreach (string s in data)
              if (!s.StartsWith(" "))
                   arr.Add(s);

          arr.Sort();
          listBox2.DataSource = arr;


I mind if it can call quick sort or....??


thnx
Posted
Updated 2-May-12 10:40am
v2
Comments
ZurdoDev 2-May-12 16:36pm    
Sounds like homework?

If you are asking what kind of sort is used by ArrayList.Sort, it uses Quicksort.
See the Remarks section in this link: http://msdn.microsoft.com/en-us/library/8k6e334t.aspx[^]
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 2-May-12 16:41pm    
That is correct, a 5.
--SA
BillW33 2-May-12 17:10pm    
Thanks, SA :)
VJ Reddy 2-May-12 22:50pm    
Good answer. 5!
Rahul Rajat Singh 3-May-12 0:58am    
+5 for the answer and link
As mentioned in the solution 1, Sort method of the System.Array class of mscorblib.dll used QuickSort internally as showing below,

C#
IL_0128:  call   instance void System.Array/SorterGenericArray::QuickSort(int32,
                                                                                int32)


Hope it helps :)
 
Share this answer
 
Comments
VJ Reddy 2-May-12 22:50pm    
Good answer. 5!
Mohammad A Rahman 2-May-12 22:58pm    
Thanks VJ :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900