@frygge In algorithm 3 line 4 the pointer exchange is done with local temp count being set to 0. However, in algorithm 4 line 4 the exchange is done with local temp count is being set to 1. Looking through the code LINK it seems that the number in the paper should be 0?!