Talk:Sorting algorithms/Cycle sort

From Rosetta Code
Revision as of 22:32, 13 June 2014 by rosettacode>Gerard Schildberger (posed a question regard WRITE count during item placement in the array.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

number of writes

Am I missing something or is the sample algorithm (on the Wiki article Cycle sort) incorrect in regards to the number of item writes (when placing items in the array)?

Whenever a swap is done, the write count is bumped by 1 (one), but in fact, two writes are done (for two items, agreeably it was done with a swap so it may appear that only one write was performed).   It appears it's counting swaps instead of writes. -- Gerard Schildberger (talk) 22:32, 13 June 2014 (UTC)