Talk:Sorting algorithms/Cocktail sort with shifting bounds: Difference between revisions

From Rosetta Code
Content added Content deleted
(added a topic.)
 
m (added highlighting.)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
== times for ''cocktail sort'' versus ''cocktail sort with shifting bounds ==
== timings for   ''cocktail sort''   vs.   ''cocktail sort with shifting bounds ==


I did some timings   (using the '''REXX''' program entries)  
I did some timings   (using the '''REXX''' program entries)  
for the Rosetta Code   ''cocktail sort''   task versus
for the Rosetta Code
the   ''cocktail sort with shifting bounds''   task.


::::::: ''cocktail sort task''
:::::::: <small> versus the </small>
::::::: ''cocktail sort with shifting bounds task''.



All timings used the same identical set of random integers.
All timings used the same (repeatable) identical set of random integers &nbsp; (by using a &nbsp; ''seed'' &nbsp; for the &nbsp; '''random''' &nbsp; BIF).


The integers were in the range of &nbsp; 0 ──► 100k, &nbsp; with every
The integers were in the range of &nbsp; 0 ──► 100k, &nbsp; with every
Line 18: Line 21:
shifting bounds
shifting bounds
times faster than
times faster than
N a cocktail sort (*)
N a cocktail sort (&Dagger;)
════════ ════════════════════════
════════ ════════════════════════
1k 1.272
1k 1.272
Line 27: Line 30:
20k 1.244
20k 1.244
════════ ════════════════════════
════════ ════════════════════════
&nbsp;

(*) cocktail sort ÷ by
(&Dagger;) cocktail sort <b><big>÷</big></b> by
cocktail sort with shifting bounds
cocktail sort with shifting bounds




For any amount of &nbsp; '''N''' &nbsp; integers already in order, &nbsp;
For any amount of &nbsp; '''N''' &nbsp; integers <u>already&nbsp;in&nbsp;order</u>, &nbsp;
the timings were identical, &nbsp; and for the most part, &nbsp; the
the timings were identical, &nbsp; and for the most part, &nbsp; the
times used by both sort versions weren't notable.
times used by both sort versions weren't notable.

Latest revision as of 13:52, 11 July 2021

timings for   cocktail sort   vs.   cocktail sort with shifting bounds

I did some timings   (using the REXX program entries)   for the Rosetta Code

cocktail sort task
versus the
cocktail sort with shifting bounds task.


All timings used the same (repeatable) identical set of random integers   (by using a   seed   for the   random   BIF).

The integers were in the range of   0 ──► 100k,   with every other number being negated,   using   N   numbers.


All timing were performed on a moderately fast air─gap PC.


                            cocktail sort with
                              shifting bounds
                             times faster than
                  N           a cocktail sort (‡)
               ════════   ════════════════════════
                  1k              1.272
                  2k              1.228
                  4k              1.256
                  8k              1.251
                 10k              1.246
                 20k              1.244
               ════════   ════════════════════════
                                                                   
                          (‡)  cocktail sort  ÷  by
                               cocktail sort with shifting bounds


For any amount of   N   integers already in order,   the timings were identical,   and for the most part,   the times used by both sort versions weren't notable.

-- Gerard Schildberger (talk) 21:46, 9 May 2020 (UTC)