Thread View: comp.arch
1 messages
1 total messages
Started by Stefan Monnier
Tue, 06 Oct 2026 18:55
Re: Optimization by programmers
Author: Stefan Monnier
Date: Tue, 06 Oct 2026 18:55
Date: Tue, 06 Oct 2026 18:55
15 lines
2376 bytes
2376 bytes
> What I found most interesting is how it sorts or why it sorts. It
> took me a while to understand what makes it work. It is difficult,
> for example, to write invariants for this code that can be used to
> establish the conclusion that sorting actually takes place.
Indeed, mostly because the first iteration (i=0) is completely different
from the other ones: the swaps that take place happen only when
i > j or i == 0
So only the first iteration of the outer loop really works on the whole
array. The subsequent ones do nothing once j > i.
=== Stefan
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads