# Sorting Arrays by enum

• 11-25-2009, 01:01 AM
sahity1a@yahoo.com
Sorting Arrays by enum
I need to make a sorting algorithm.

The program takes an input file that stores the information into an array: the array has student's name and a personality type.

The personality types are: enum values

Realistic
Artistic
Social
Conventional

Then once it takes an array, it sould divide the main array into 4 arrays with the personality types.

So the new array have all the same personality types and the students name.

Then I need it to divide the 4 arrays by a number. Then number can change at any time.

So it looks something like this

Mary Realistic
Lisa Artistic
Bill Artistic
Jake Realistic
Loren Conventional
Mike Social
Jessica Conventional
Rick Realistic
Karen Artistic
Lily Social
John Social

divides into four arrays

Array 1
Mary Realistic
Jake Realistic
Rick Realistic

Array 2
Lisa Artistic
Bill Artistic
Karen Artistic

Array 3
Lily Social
John Social
Mike Social

Array 4
Loren Conventional
Jessica Conventional

Then they select they want a group with 2 people

group 1
Mary, Jake

group 2
lisa, Bill

group3
lily, john

group4
loren, jessica

That leaves Rick, Karen, Mike.
so it places

group 5
Rick and Karen

and then place Mike in the first group with Mary and jake

so it would be

group 1
Mary, Jake, Mike

group 2
lisa, Bill

group3
lily, john

group4
loren, jessica

group 5
Rick and Karen

I know the problem is a little long, but I am not sure how to start on it. Any help is very well appreciated.

Thank You
• 11-25-2009, 10:31 AM
Tolls
Break it down.