473,511 Members | 15,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fastest sort algorithm?

Hi,

I have a structure of 3 16-bit values. I have either 65000, 256000 or 1
million instances of this structure. I want to sort the lot of them
according to the number contained in one of the fields. Duplicate
values are allowed. So obviously if many instances of the structure
have the same value in this field, they must be together but they can be
in any order. The instances are already weakly sorted.

On modern Pentium 4/Athlon/G5, what would be the fastest algorithm to
use, and does anyone have any pointers to a fast implementation?
Jul 23 '05 #1
3 2541
REH

"Richard Cavell" <ri***********@mail.com> wrote in message
news:d2*********@nnrp.waia.asn.au...
Hi,

I have a structure of 3 16-bit values. I have either 65000, 256000 or 1
million instances of this structure. I want to sort the lot of them
according to the number contained in one of the fields. Duplicate
values are allowed. So obviously if many instances of the structure
have the same value in this field, they must be together but they can be
in any order. The instances are already weakly sorted.

On modern Pentium 4/Athlon/G5, what would be the fastest algorithm to
use, and does anyone have any pointers to a fast implementation?


This is OT, but I'll try and help. You data set is probably prohibitively
large for all O(n) sort except for the Radix sort. I would also look at the
introspection sort (O(n log n)). How sorted is your weakly sorted data?
There are sorts that are or approach O(n) if the data is close to being
already sorted.

I have C++ implementation of many sorts, including three O(n) sorts, but not
here at work. If you like, I can email them to you this evening.

REH
Jul 23 '05 #2
On 1/4/05 12:48 AM, REH wrote:
This is OT, but I'll try and help. You data set is probably prohibitively
large for all O(n) sort except for the Radix sort. I would also look at the
introspection sort (O(n log n)). How sorted is your weakly sorted data?
My data looks like a sawtooth waveform when graphed out (not perfectly
so, but definitely that sort of shape). I'm trying to get it into a
perfect ramp.
I have C++ implementation of many sorts, including three O(n) sorts, but not
here at work. If you like, I can email them to you this evening.


Yes please.
Jul 23 '05 #3
REH

"Richard Cavell" <ri***********@mail.com> wrote in message
news:d2**********@nnrp.waia.asn.au...
On 1/4/05 12:48 AM, REH wrote:
This is OT, but I'll try and help. You data set is probably prohibitively large for all O(n) sort except for the Radix sort. I would also look at the introspection sort (O(n log n)). How sorted is your weakly sorted data?


My data looks like a sawtooth waveform when graphed out (not perfectly
so, but definitely that sort of shape). I'm trying to get it into a
perfect ramp.
I have C++ implementation of many sorts, including three O(n) sorts, but not here at work. If you like, I can email them to you this evening.


Yes please.


I didn't see your reply until I got to work this morning, so I'll send them
this evening. Each sort is encapsulated in a class, with traits that
defines such things as its performance, stability, in-place sorting, etc.
This is also a test program that times each sort and records the number of
swaps and compares (if appl.).

REH
Jul 23 '05 #4

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

Similar topics

2
2648
by: tommazzo | last post by:
Hi! I'm looking for a way to find the position of a certain pattern within a string. On my search on the internet I've come accross various algorithms such as Knuth-Morris-Pratt and Boyer-Moore...
2
6449
by: yee young han | last post by:
I need a fast data structure and algorithm like below condition. (1) this data structure contain only 10,000 data entry. (2) data structure's one entry is like below typedef struct _DataEntry_...
60
48983
by: Julie | last post by:
What is the *fastest* way in .NET to search large on-disk text files (100+ MB) for a given string. The files are unindexed and unsorted, and for the purposes of my immediate requirements, can't...
11
3586
by: hoopsho | last post by:
Hi Everyone, I am trying to write a program that does a few things very fast and with efficient use of memory... a) I need to parse a space-delimited file that is really large, upwards fo a...
2
1673
by: The One We Call 'Dave' | last post by:
I have a list of DateTime objects stored in a collection: SortedList<DateTime,Object> MyDates=new SortedList<DateTime,Object>(); The dates, which can be accessed via MyDates.Keys, are stored in...
1
2410
by: Harry Haller | last post by:
What is the fastest way to search a client-side database? I have about 60-65 kb of data downloaded to the client which is present in 3 dynamically created list boxes. The boxes are filled from 3...
12
5044
by: Godzilla | last post by:
Hello, I'm trying to find a way to convert an integer (8-bits long for starters) and converting them to a list, e.g.: num = 255 numList = with the first element of the list being the...
24
2264
by: ThunderMusic | last post by:
Hi, The subject says it all... I want to use a byte and use it as byte* so I can increment the pointer to iterate through it. What is the fastest way of doing so in C#? Thanks ThunderMusic
21
1557
by: Pieter | last post by:
Hi, I need some type of array/list/... In which I can store objects together with a unique key. The most important thing is performance: I will need to do the whole time searches in the list of...
0
7251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7148
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
7430
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
7517
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...
0
5673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
451
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.