Download presentation
Presentation is loading. Please wait.
Published byDamon James Modified over 9 years ago
1
SFTW241 PROGRAMMING LANGUAGES ARCHITECTURE I Leader : Peter Wong Secretary : Su Project Tracker : Jesse Web Admin : Nelson Liaison : Jacky
2
Group B3 original Grouping Process Algorithm. Problems of output result in Group B3’s Algorithm. Modified idea of Grouping Process. C program implementation. Sample output result. Analysis of our modified version. Advice and Feedback from Group B3.
3
Leader Array : contains 4 strings corresponding to 4 teams. Member Array : which contain 16 strings. (MA) Programming Algorithm: 1.Randomly load the information of the four leaders into the leader array. 2.Load the rest information of the classmates into the MA. 3.Four leader’s information were loaded into the rest positions of the MA. 4.Use MA both for information storage and checking. 5.The pointer: member Counter is the boundary between un-used information and used information 6.If a new member is added, then she or he become the new “leader” whose information will be loaded into the LA instead of the older one. 7. If all of the choices of a “leader” have already been in used array, then the corresponding team should stop their grouping.
4
Walter WFZH LJQ YYY Walter WFZH LJQ YYY WFZH LJQ YYY LJQ POINTER GROUP A MEMBER LIST OUTPUT : YYY Next Search : LJQ
5
WFZH LJQ YYY LJQ Walter WFZH LJQ YYY Walter WFZH LJQ YYY WFZH LJQ YYY LJQ REPLACE GROUP A MEMBER LIST POINTER
6
YYY WFZH LJQ YYY LJQ Walter WFZH LJQ YYY WFZH LJQ YYY LJQ Walter LJQ WFZH GROUP A MEMBER LIST POINTER OUTPUT : LJQ Next Search : YYY ( NOT FOUND ) LJQ ( HAS USED ) WFZH
7
LJQ YYY LJQ Walter WFZH LJQ YYY WFZH LJQ YYY LJQ Walter LJQ YYY WFZH REPLACE GROUP A MEMBER LIST POINTER YYY Walter LJQ WFZH
8
YYY Walter WFZH LJQ YYY WFZH LJQ YYY LJQ Walter LJQ WFZH Walter LJQ YYY WFZH GROUP A MEMBER LIST POINTER OUTPUT : WFZH Next Search : YYY ( NOT FOUND ) LJQ ( HAS USED ) Walter ……. Continue Searching
9
They have a fatal error in producing the output result if there is a looping in member choosing. ( Since the preceding member records have been deleted ) The generated result is always remained the same. The size of the member array is required to define. The number of groups rendered cannot be modified. They haven’t consider the situation of the orphan’s case. They have used extra space for the storage of group members. A lot of swapping will be performed during the execution of the program. This will become a big problem if the number of student records increase.
10
Student should give their own favorite members. First Choice Third Choice Second Choice
11
Figure : Students’ record link list Peter Jesse Nelson Su Jacky Thomas Jesse Peter Tony Peter Su Eva John Su Jesse John Tom Jacky Peter N students This is the linked list created by the initialization part. Student NameFirst ChoiceSecond ChoiceThird Choice
12
Figure : Groups link list M Groups Peter Jesse Nelson Su Tom Tim Jacky Barry Eva John Tony Kent This is the final grouped list that is created by the main program. ( Already considered the orphan’s situation ) Member 1Member 2Member n
14
Continue… Initialization of the Program. /* Global Variable */ List Student[student_size] ; List Group[group_number] ; int student_selected[student_size] ; int remain = student_size ;
15
Continue… Essential Functions of the Program. /*Search the student according to the algorithm*/ char* search_student( char *name) ; /* Input the information from text file */ void Input_Student_File( ) ; /*random select student if choices link is break*/ char* random_student( ) ;
16
Main Procedures of the Program. Continue… int main( ) { Input_Student_File( ) ; /* Randomly select m student for m groups as the headers and insert to the group link list. */ for ( i = 0 ; i < group_number ; i++ ) random_select( ) ;
17
/* main loop for selecting student */ for (i = 0 ; remain > 0; i++) {if ( student is found in record ) search_student( student_name) ; else if (student link list is break ) random_select( ) ; else if ( remain < m) then */ random_select_group */ random_select( ) ; } } Main Procedures of the Program.
18
There are 21 student records and 4 groups need to be created.
19
There are 21 student records and 6 groups need to be created.
20
Fixed the fatal error and random problems for their algorithm. Provide the solution to solve the orphan’s case. Use the linked list for the member and the grouped list, this is due to the ease of extension and modification of member lists. We eliminate the swapping part. We use the index array to store the location of unselected student record list, it decrease the failures in searching.
21
Better to implement the student ID number in student records. Searching by student ID is faster and more efficient than searching by student Name. searching by student Name. Extra space is still needed for the resulting group linked list. Flexibility in Number of Members and number of groups. Very clear in understanding the programming algorithm. Good in considering the orphan cases and cycle cases that they haven’t considered and solved. that they haven’t considered and solved.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.