All pastes #757983 Raw Edit

Something

public text v1 · immutable
·published 2007-11-01 20:14 UTC
rendered paste body
...

while(1) { //better use counter here instead of scary 1
  didswap= 0
  for(i=firstoflistbase; i; i= i.next) {
    next= i.next
    if(i.val > next.val) { swap(i.val, next.val); didswap= 1 }

    if(next.next == NULL) break
  }

  if(didswap == 0) break
}