<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Ondrej Pokorny via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>> schrieb am Di., 29. Nov. 2022, 11:39:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>Am 29.11.2022 um 11:08 schrieb Sven
Barth via fpc-devel:<br>
</div>
<blockquote type="cite">
<div dir="auto">
<div>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">J. Gareth Moreton via
fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org" target="_blank" rel="noreferrer">fpc-devel@lists.freepascal.org</a>>
schrieb am Di., 29. Nov. 2022, 10:09:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Surely
that's a bug in the comparison functions that should be
fixed and <br>
not something that can be blamed on introsort. If a
comparison function <br>
is faulty, then pretty nuch any sorting algorithm can be
considered to <br>
have unpredictable behaviour.<br>
</blockquote>
</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">This *can* be blamed on IntroSort, because
Stability (order of equal elements is kept) is an attribute of
sorting algorithms and IntroSort is *not* considered stable
while QuickSort *can* be stable depending on the
implementation and ours *is*.</div>
</div>
</blockquote>
<p>If for two elements [a, b] the comparison function returns<br>
a<b=true and b<a=true</p>
<p>then the problem is not in stability or any other feature of the
sorting algorithm but in the comparison function indeed. Or am I
missing something?</p></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">For such a comparison function the issue is indeed in the comparison function, but Nikolay also mentioned "a<b=false and b<a=false" which is the case for equal elements. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>