@manish wat is the complexity ?? think about it...
"sort balls[] on the basis of code[color_tag]" wat r u doing here ?? On Tue, Sep 8, 2009 at 8:35 PM, manish bhatia <mb_mani...@yahoo.com> wrote: > Assign 0 to K numbers to all K colors, such that color -> color_tag (a > number b/w [0,K-1]). > code[k] = {0,2,..,k-1} > foreach (permutation from all possible-permuations of code[]) > sort balls[] on the basis of code[color_tag] > print balls[] > > > ------------------------------ > *From:* ankur aggarwal <ankur.mast....@gmail.com> > *To:* lets-talk-g...@googlegroups.com; algogeeks@googlegroups.com > *Sent:* Sunday, 6 September, 2009 1:36:01 PM > *Subject:* [algogeeks] n balls having k colors > > You have N balls having one of K colors. Arrange them into groups of same > colors. e.g. > > RRRRRRGRG > can be arranged as > RRRRRRRGG (Answer) > GGRRRRRRR > ------------------------------ > See the Web's breaking stories, chosen by people like you. Check out Yahoo! > Buzz <http://in.rd.yahoo.com/tagline_buzz_1/*http://in.buzz.yahoo.com/>. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---