Hacker News new | ask | show | jobs
by Jtsummers 1445 days ago
That's not the same sort as in the article. Two key differences:

1. j in the article runs from 0 to array_size-1 (if done in C like this, in the article it's a 1-based array so 1 to array_size). This sort has j run from i+1 to array_size-1.

2. The swap condition is reversed. In the article's sort the swap happens when array[i] < array[j].