473,394 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Fast sort

Dear all,
what is the best collection for fast sort of small (about 100) data rows.I
want to use collection's sort algorithm, instead of implementing my own.
Thanks,
Boni
Nov 21 '05 #1
3 1538
Check out SortedList

"Boni" <oilia@nospam> wrote in message
news:e5***************@TK2MSFTNGP10.phx.gbl...
Dear all,
what is the best collection for fast sort of small (about 100) data rows.I
want to use collection's sort algorithm, instead of implementing my own.
Thanks,
Boni

Nov 21 '05 #2
"Boni" <oilia@nospam> schrieb:
what is the best collection for fast sort of small (about 100) data rows.I
want to use collection's sort algorithm, instead of implementing my own.


'ArrayList.Sort' and 'Array.Sort' are implemented as a quick-sort algorithm,
which is pretty fast for most cases (Theta(n log(n)) for n items).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
Keep in mind though that QuickSort is pretty slow for a collection of items
that are pre-sorted, or nearly sorted, beforehand - worst case O(n ^ 2)
instead of the best case O(n lg n) that Herfried pointed out. With only 100
items it probably won't make a noticeable difference anyway, but keep that
in mind if you add more items to your collection; or if you perform this
sort a bunch of times.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uf**************@TK2MSFTNGP15.phx.gbl...
"Boni" <oilia@nospam> schrieb:
what is the best collection for fast sort of small (about 100) data
rows.I want to use collection's sort algorithm, instead of implementing
my own.


'ArrayList.Sort' and 'Array.Sort' are implemented as a quick-sort
algorithm, which is pretty fast for most cases (Theta(n log(n)) for n
items).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Uwe Mayer | last post by:
Hi, Using PyQt I got a QListView with about 800 entries now (but its intended to be scalable up to about 3000). The first column contains numerical data. Now Qt does the sorting all by its self...
6
by: ramon aragues | last post by:
Hi, I´ve got a list with more than 500,000 ints. Before inserting new ints, I have to check that it doesn´t exist already in the list. Currently, I am doing the standard: if new_int not in...
8
by: Neil | last post by:
I have a very puzzling situation with a database. It's an Access 2000 mdb with a SQL 7 back end, with forms bound using ODBC linked tables. At our remote location (accessed via a T1 line) the time...
22
by: Marc Mones | last post by:
Hello, I'working with IBM DB2 V8.1 and CLI/ODBC. I've got a problem with the following statement: ******************************************************************************** SELECT...
0
by: Armando | last post by:
I'm writing an app to do gift card processing at a friend's movie theatre, and in dummying up some movie names I'm basically designing the ticketing system we both agree is the logical next step. ...
6
by: thecodemachine | last post by:
Hi, I'm looking for a fast and simple one to one hash function, suitable for longer strings (up to 2048 in length). I'd like keys to be relatively short, I doubt I'd be creating more than 256...
13
by: tim.lino | last post by:
Hello, I would like to use C++ STL to store a set of Object's which is as follows: class Object { public: int value; ......
19
by: Juha Nieminen | last post by:
If I'm not completely mistaken, the only reason why std::list::size() may be (and usually is) a linear-time operation is because they want std::list::splice() to be a constant-time operation, and...
4
by: Ty | last post by:
Hi all Short version of my problem: i have a Datagrid (Flexgrid from ComponentOne) with a Datatable as source. I need to search a row in the datatable, using a primary key column in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.