Author |
Topic: One pass sort (Read 2850 times) |
|
sateesp
Newbie
Gender:
Posts: 35
|
|
One pass sort
« on: Jul 28th, 2010, 10:46pm » |
Quote Modify
|
Given an array with consists of 0's, 1's and 2's only in random order. Can we sort this array in one pass?
|
|
IP Logged |
|
|
|
birbal
Full Member
Gender:
Posts: 250
|
|
Re: One pass sort
« Reply #2 on: Jul 29th, 2010, 11:21am » |
Quote Modify
|
Save begining for 0's , ending for 2's , then you automatically have all 1's in the middle. Its sorted
|
|
IP Logged |
The only thing we have to fear is fear itself!
|
|
|
|