sort list without recursion