"I have a sequence of 1's and 0's and i have sorted it...How do i get the same sequence back? Is there any algorithm for it? EDIT:We can't do this without having any extra information about the positions, so i need a solution which requires less memory to store that ""extra information""."