Please show what output you expect from your example 1 9 2 8 3 7 4 6 5 10.
In reply to Re: Longest Increasing Subset by tybalt89 in thread Longest Increasing Subset by gilthoniel