sort an array f 0 1 and 2s
flatten a linked list