It is possible to do it in O(n) time and O(1) space apparently. The paper Stable minimum space partitioning in linear time by Jyrki Katajainen, and Tomi Pasanen claims to be able to do it.
Google for stable 0-1 sort.
More Related Contents:
- C++ Sorting Algorithms [closed]
- What should be the algorithm of the below statement?
- Efficient way to add element to sorted datastructure [closed]
- How can I pair socks from a pile efficiently?
- Fastest sort of fixed length 6 int array
- Is there an O(n) integer sorting algorithm?
- Why is quicksort better than mergesort?
- Which sort algorithm works best on mostly sorted data? [closed]
- Merge Sort a Linked List
- Quicksort: Choosing the pivot
- Natural Sorting algorithm
- Algorithm to separate items of the same type
- Compute the minimal number of swaps to order a sequence
- Which parallel sorting algorithm has the best average case performance?
- Optimal algorithm for returning top k values from an array of length N
- Fast algorithm implementation to sort very small list
- Sorting in linear time? [closed]
- Quick Sort Vs Merge Sort [duplicate]
- How to rank a million images with a crowdsourced sort
- median of three values strategy
- Sort Four Points in Clockwise Order
- Sorting an array with minimal number of comparisons
- What is a bubble sort good for? [closed]
- Sorting in place
- Write a program to find 100 largest numbers out of an array of 1 billion numbers
- Quicksort superiority over Heap Sort
- Design an efficient algorithm to sort 5 distinct keys in fewer than 8 comparisons
- Search a sorted 2D matrix [duplicate]
- When is each sorting algorithm used? [closed]
- Find the pair across 2 arrays with kth largest sum