jbgo / Team-Forming-System

Software Engineering Project
2 stars 2 forks source link

Implement random assignment algorithm #10

Open jbgo opened 14 years ago

dracko86 commented 14 years ago

inputs: int group size --> gs array/arraylist/list of students --> sList bool prevent undersize groups --> pug

process: PRE-1 check if the student list is empty or null or if gs<1 - if true then return null

PRE-2 if gs == 1, create a group object and add all students to it and return it in a single element array

  1. Get the number of students in the list -> numStudents
  2. create a collections type copy of the student list -> nList
  3. call shuffle() on the new list and save new list to nList
  4. int numGroups = numStudent / gs;
  5. if (numStudents % gs !=0) and !pug then numGroups++;
  6. Create an array of size gs of empty Groups ->GA
  7. int index=0; for(Student stud : nList) { GA[index].add(stud); index++; if (index==GA.length) { index=0; } }
  8. return GA
dracko86 commented 14 years ago

Very complete as is.