Download presentation

Presentation is loading. Please wait.

Published byTroy Veazie Modified about 1 year ago

1
SFTW241 Group A4 Presentation of Grouping Process

2
Idea of the Grouping Process (I) Create the student records. Randomly select four students from the global student file. Assign these four students into four different groups and those students will become the member of their corresponding group. For each group, recall back the last selection of group member, and according to his/her first choice, pick up the desired member from the remaining student records.

3
Idea of the Grouping Process (II) Check whether the desired student has already been chosen or not. –If he/she has not been chosen, insert his/her student file into the group. –Otherwise, choose another student according to the lower choices of previous student record and perform the same process again. –If the selection of students from the remaining choices have already been grouped, the only case is to randomly select a student from the remaining student records and assign his/her student file into the corresponding group. –Remember that the previous student record is required to push back into the group. ( Since it has recalled from the group )

4
Idea of the Grouping Process (III) When a student has been assigned to a group, the right for selecting another student shifts to the adjacent group. That means the group has to queue until the remaining groups have chosen their own members. This grouping process will be terminated until there are no more remaining student record in the student file.

5
Pseudo code of Grouping Process Students Struct { longint Student_ID; char Student_Name[30]; longint First, Second, Third; int Choose = 0; } student_type ; First, we need build up a data type for each Student and it is used for creating the global student file.

6
Implementation of grouping process (Pseudo Code) I int main() { Stack S[4] ; /* Here the stack will have the structure of Student type */ /* And this represent we have build up 4 stacks. */ Student_type Students[Stundent_Size]; int remain = Stundent_Size, lcv = 1 ; longint result; S[1] = CreateStack_and_MakeEmpty(); S[2] = CreateStack_and_MakeEmpty(); S[3] = CreateStack_and_MakeEmpty(); S[4] = CreateStack_and_MakeEmpty(); Input_Student_Record( Students );

7
/* This function is used to randomly select four person from the global student list and put these four person into four different stacks.*/ for ( i starts from 1 to 4 ) { result = Randomize(); Student[result].Choose = 1; Push( S[I], Student[result] ) ; remain-- ; /* This is used to denote the remaining number of students.*/ } Implementation of grouping process (Pseudo Code) II

8
while( remain ) { FindNext(Pop( S[lcv] ), S[ lcv ], Students, Stundent_Size ) ; remain -- ; if ( lcv == 4 ) lcv = 1 ; /*Reset the next input into the 1 st stack.*/ else lcv ++ ; } return 0 ; } //end of program Implementation of grouping process (Pseudo Code) III

9
The function FindNext (I) void FindNext( student_type Temp_Src,Stack Src_Stack,Student_type Students[], int Size) { longint tmp ; Push( Src_Stack, Temp_Src ) ; /* * because Temp_Src had been Popped before the function call * we need to Push it back to the Stack. */

10
/* * tmp = Temp_Src.First ; * Check the student with this student ID is still available or not * if available then Skip the remain process * else{ * tmp = Temp_Src.Second ; * If available then Skip the remain process * else{ * tmp = Temp_Src.Third ; * If available then Skip the remain process *else { do{ * tmp = Randomize(); *}while (Student[tmp].Choose = 1) * } * Student[tmp].Choose = 1; * Push(Src_Stack, Student[tmp]. ) ; */ } The function FindNext (II)

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google