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 any help is very well appreciated.

Thank You

From the original array count how many people there are for each personality type and have those values be in 4 variables. Use those 4 variables to create 4 arrays and then loop again in order to populate them.

As for the rest we will not give it another thought unless we see some code for the first.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.