Board index » delphi » sorting

sorting

can anyone please guide me as to the effect of increasing my knowledge about
the various methods of sorting i know only names such as bubble sort, radix
sort, merge sort, insertion sort. plz tell if there are anymore and post the
code for the fastest one .
Pls note i'm a beginner
--
Diabolic_Preacher
The Evil shall rule
B'Coz The Preacher said so....

 

Re:sorting


see "Algorithms" by Sedgwick (don't know ISBN for English version). I also
have a small article on my homepage:
http://privat.schlund.de/bossung/prog/delphi/sorting.html

Sebastian

Quote
Diabolic_Preacher wrote:

> can anyone please guide me as to the effect of increasing my knowledge
> about the various methods of sorting i know only names such as bubble
> sort, radix sort, merge sort, insertion sort. plz tell if there are
> anymore and post the code for the fastest one .
> Pls note i'm a beginner
> --
> Diabolic_Preacher
> The Evil shall rule
> B'Coz The Preacher said so....

Re:sorting


Also see "The Art of Computer Programming" by Donald Knuth.  I believe that
Volume 3 is called "Sorting and Searching".  Since this is a Pascal newsgroup,
Nicholas Wirth's book "Algorithms + Data Structures = Programs" also has a
nice discussion of the various sorting methods, along with some analysis of
their timing, efficiency, etc.

Bob Schor
Pascal Enthusiast

Quote
Sebastian Bossung wrote:
> see "Algorithms" by Sedgwick (don't know ISBN for English version). I also
> have a small article on my homepage:
> http://privat.schlund.de/bossung/prog/delphi/sorting.html

> Sebastian

> Diabolic_Preacher wrote:

> > can anyone please guide me as to the effect of increasing my knowledge
> > about the various methods of sorting i know only names such as bubble
> > sort, radix sort, merge sort, insertion sort. plz tell if there are
> > anymore and post the code for the fastest one .
> > Pls note i'm a beginner
> > --
> > Diabolic_Preacher
> > The Evil shall rule
> > B'Coz The Preacher said so....

Re:sorting


Quote
Diabolic_Preacher <pint00...@yeehaw.com> wrote:
> can anyone please guide me as to the effect of increasing my knowledge about
> the various methods of sorting i know only names such as bubble sort, radix

 72) Where to I find the different sorting source codes?

 165966 Jan 8 2000 ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip
 tsfaqp.zip Common Turbo Pascal Questions and Timo's answers, linked

   All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland
Timo's  FAQ  materials  at   http://www.uwasa.fi/~ts/http/tsfaq.html

Re:sorting


Quote
"Diabolic_Preacher" <pint00...@yeehaw.com> wrote:
>can anyone please guide me as to the effect of increasing my knowledge about
>the various methods of sorting i know only names such as bubble sort, radix
>sort, merge sort, insertion sort. plz tell if there are anymore and post the
>code for the fastest one .

That's a big topic, and there is no clear answer as to speed.
The fastest general sort routine is probably QuickSort.  Heap
sort is a somewhat slower than Quicksort, but it is guaranteed
to be fast, whereas Quicksort can be slow on some data.  Shell
sort is also pretty good, the one I use most of the time.  Radix
sort is very fast (much faster than Quicksort) - if the data is
right for it.  The other sorts such as insertion sort, merge
sort, bin sort, selection sort, and exchange sort have their
places too.  Bubble sort is usually about the worst one, but it
has its uses too.  Good books:

Algorithms by Sedgewick covers a few of them, including Quick
and Shell (best intro, I think)

Introduction to Algorithms by Cormen, Leiserson, and Rivest
(probably my favorite)

The Algorithm Design Manual,  Skiena

The Art of Computer Programming, vol 3, searching and sorting,
by Knuth - by far the most complete, but goes into a lot of
mathematical detail.

Re:sorting


Quote
On Fri, 29 Jun 2001, Diabolic_Preacher wrote:
> can anyone please guide me as to the effect of increasing my knowledge about
> the various methods of sorting i know only names such as bubble sort, radix
> sort, merge sort, insertion sort. plz tell if there are anymore and post the
> code for the fastest one .

See the three volume set "The Art of Computer Programming" by Prof. Donald
E. Knuth. One of the volumes deals exclusively with sorting and will tell
you everything you ever wanted to know about sort and everything you never
wanted to know about sorting.

--
john R. Latala
jrlat...@golden.net

Re:sorting


Quote
"Diabolic_Preacher" <pint00...@yeehaw.com> wrote:
>can anyone please guide me as to the effect of increasing my knowledge about
>the various methods of sorting i know only names such as bubble sort, radix
>sort, merge sort, insertion sort. plz tell if there are anymore and post the
>code for the fastest one .

I started writing an intro tutorial to sorting years ago.  I
need to update it, finish it, and put it on the web.  Maybe I
will sometime soon.

Re:sorting


In article <aq0qjtoktcusl81alnlfks96spc8e18...@4ax.com>,
Jan Philips  <jud.mccranieNOSP...@mindspring.com> wrote:

Quote
>That's a big topic, and there is no clear answer as to speed.
>The fastest general sort routine is probably QuickSort.

That is with arrays. If you can use lists then merge sort is much faster
by a factor of four or so. It also is guaranteed to be fast.

Osmo

Re:sorting


Quote
ronka...@cc.helsinki.fi (Osmo Ronkanen) wrote:
>That is with arrays. If you can use lists then merge sort is much faster
>by a factor of four or so. It also is guaranteed to be fast.

Merge sort is also good for disk files that won't fit in memory.

Today I've started back working on my sorting tutorial.  I
started writing an article in the late 80s, and I asked Byte if
they wanted to publish it.  They said that they were getting
away from having new stuff and wanted to rehash manuals for
people who either didn't have the manuals or didn't understand
them.  Then 80 Micro was interested, but went out of business.

Re:sorting


Quote
In article <9hl20c$9c...@oravannahka.helsinki.fi>, Osmo Ronkanen wrote:
> In article <aq0qjtoktcusl81alnlfks96spc8e18...@4ax.com>,
> Jan Philips  <jud.mccranieNOSP...@mindspring.com> wrote:
>>That's a big topic, and there is no clear answer as to speed.
>>The fastest general sort routine is probably QuickSort.

> That is with arrays. If you can use lists then merge sort is much faster
> by a factor of four or so. It also is guaranteed to be fast.

And, if the list IS already sorted (e.g. sorted, one record added,
and sorted again), heap sort is probably faster.

Re:sorting


In article <slrn9jv6hv.2e1o.mar...@toad.stack.nl>,
Marco van de Voort <mar...@toad.stack.nl> wrote:

Quote
>In article <9hl20c$9c...@oravannahka.helsinki.fi>, Osmo Ronkanen wrote:
>> In article <aq0qjtoktcusl81alnlfks96spc8e18...@4ax.com>,
>> Jan Philips  <jud.mccranieNOSP...@mindspring.com> wrote:
>>>That's a big topic, and there is no clear answer as to speed.
>>>The fastest general sort routine is probably QuickSort.

>> That is with arrays. If you can use lists then merge sort is much faster
>> by a factor of four or so. It also is guaranteed to be fast.

>And, if the list IS already sorted (e.g. sorted, one record added,
>and sorted again), heap sort is probably faster.

Sorting is a wrong tool to use for that kind of a problem. With
Mergesort you would just merge the element to the rest of the list. In
anyway mergesort can be written to utilize the existing order.

Also how would you do heapsort on lists?

Osmo

Re:sorting


Quote
In article <9hq1j2$fu...@oravannahka.helsinki.fi>, Osmo Ronkanen wrote:
> In article <slrn9jv6hv.2e1o.mar...@toad.stack.nl>,
> Marco van de Voort <mar...@toad.stack.nl> wrote:
>>In article <9hl20c$9c...@oravannahka.helsinki.fi>, Osmo Ronkanen wrote:
>>> In article <aq0qjtoktcusl81alnlfks96spc8e18...@4ax.com>,
>>> Jan Philips  <jud.mccranieNOSP...@mindspring.com> wrote:
>>>>That's a big topic, and there is no clear answer as to speed.
>>>>The fastest general sort routine is probably QuickSort.

>>> That is with arrays. If you can use lists then merge sort is much faster
>>> by a factor of four or so. It also is guaranteed to be fast.

>>And, if the list IS already sorted (e.g. sorted, one record added,
>>and sorted again), heap sort is probably faster.

> Sorting is a wrong tool to use for that kind of a problem.

For only one, yes.

Quote
> With
> Mergesort you would just merge the element to the rest of the list. In
> anyway mergesort can be written to utilize the existing order.

> Also how would you do heapsort on lists?

Sort an array of pointer, then relink the list.

Re:sorting


In article <slrn9k1amq.lvd.mar...@toad.stack.nl>,
Marco van de Voort <mar...@toad.stack.nl> wrote:

Quote
>In article <9hq1j2$fu...@oravannahka.helsinki.fi>, Osmo Ronkanen wrote:

>> Also how would you do heapsort on lists?

>Sort an array of pointer, then relink the list.

That definetely would be slower than mergesort.

Osmo

Re:sorting


Quote
In article <9hqk70$q6...@oravannahka.helsinki.fi>, Osmo Ronkanen wrote:
> In article <slrn9k1amq.lvd.mar...@toad.stack.nl>,
> Marco van de Voort <mar...@toad.stack.nl> wrote:
>>In article <9hq1j2$fu...@oravannahka.helsinki.fi>, Osmo Ronkanen wrote:

>>> Also how would you do heapsort on lists?

>>Sort an array of pointer, then relink the list.

> That definetely would be slower than mergesort.

??  Euh, mergesort deals with several fully sorted lists ? What if you don't
have that? Mergesort can be fast, but has some prerequisites.

Re:sorting


Quote
> can anyone please guide me as to the effect of increasing my
knowledge about
> the various methods of sorting i know only names such as bubble
sort, radix
> sort, merge sort, insertion sort. plz tell if there are anymore and
post the
> code for the fastest one .

Try 'Pascal Plus - Data Structures', Nell Dale & Susan Lilly, Heath &
Co
or 'Turbo Pascal 5.5', Stephen K O'Brien, Borland Osborne

They may be old references but have good descriptions or Sorting and
Searching with code examples

Quote
> Pls note i'm a beginner

Aren't we all!

Alan

Go to page: [1] [2]

Other Threads