I want to sort a file with records which is bigger than the memory available.The thing is that I want the file to be sorted depending on a field which only can take two values:0 and 1.
For example the file :
9423 John Pappas 0
2342 George Beckham 1
9423 Mary Lu 0
7123 Nick Zidane 1
1234 Ann Adams 1
should become :
7123 Nick Zidane 1
1234 Ann Adams 1
2342 George Beckham 1
9423 Mary Lu 0
9423 John Pappas 0
not caring about the order of all the records with 1's or all those with 0's in the sorted file.
Is there a better way than external merge sort that this could be done?Maybe in O(n) time?