When will you adopt your own sorting algorithm?

Forgive me if this is a stupid question ... but I believe in my Comp. Sci. classes, and I clearly remember how several sorting algorithms and the corresponding Big O notation were studied / polled.

However, in addition to the class, I never wrote code for sorting.

When I get the results from the database, I use "Order By". Otherwise, I use a collection class that implements sorting. I applied IComparable to enable sorting; but I never went beyond that.

Was sorting always just an academic pursuit for those of us who don't implement languages ​​/ frameworks? Or is it just that modern languages ​​running on modern equipment make you worry about the little things?

Finally, when I call .Sort on the (Of String) list, for example, which sorting algorithm is used under the hood?

+5
source share
10 answers

While you rarely need to implement a sorting algorithm, you realize that various algorithms and their complexity can help you solve more complex problems.

Finally, when I call .Sort on a List (Of String), for example, which sorting algorithm is used under the hood?

Quick sort

+5
source

I have never implemented my own sorting algorithm since I took my CS classes in college, and if I even thought about writing my own, I would like my chapter to be considered first.

List<T> Quicksort MSDN:

http://msdn.microsoft.com/en-us/library/b0zbh7b6.aspx

+3

, , ...

, , , O (omicron).

, , - , , .

, , / .

.

+2

, . , , .

.Sort , .

+2
  • , , , , .
  • this, List.Sort Array.Sort, QuickSort.
+1

, . , , . , , , , , .

, .Net defualt, , Quicksort Shellsort. , - .

+1

, , (,.Net 1.1 Windows CE Java somesuch).

, , ORDER BY T-SQL.

+1

- , , , , , , , ..

, , quicksort.

+1

, /? , , , ?

, , , . , . .

+1

, , . , , ? , : Honda, Lexus, Toyota, Acura, Nissan, Infiniti

, : Acura, Ford, Honda, Hyundai, Lexus, Toyota​​p >

, ? Lexus, Toyota, Honda, Acura, Nissan, Infiniti.

I think you will need your own sorting method if this happens.

-2
source

All Articles