Re: Arranging the keys problem
- From: "Michael J. Fromberger" <Michael.J.Fromberger@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 29 Sep 2005 16:28:08 -0400
In article <1128024200.887357.322660@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"mihir" <mirdesai81@xxxxxxxxx> wrote:
> There are n keys of different 3 colors say white ,red and blue only.Now
> we have to arrange keys such that red keys come before white ones and
> white ones come before blue keys eg RWWBBB where the keys are placed in
> any random order.Give me a linear time algorithm to solve this problem
> ( O(n)).
Since this sounds a lot like a homework problem, I will refrain from
answering this question with code. However, you will be well-served by
looking up the Radix Sort algorithm,
http://www.nist.gov/dads/HTML/radixsort.html
I hope this helps.
Cheers,
-M
--
Michael J. Fromberger | Lecturer, Dept. of Computer Science
http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA
.
- Prev by Date: Re: Arranging the keys problem
- Next by Date: Re: Beginner needs help with MSB/LSB and 7bit bytes
- Previous by thread: Re: Arranging the keys problem
- Next by thread: Re: Arranging the keys problem
- Index(es):
Relevant Pages
|