SFTW241 Group A4 Presentation of Grouping Process.

Slides:



Advertisements
Similar presentations
Stacks, Queues, and Linked Lists
Advertisements

SYMBOL TABLES &CODE GENERATION FOR EXECUTABLES. SYMBOL TABLES Compilers that produce an executable (or the representation of an executable in object module.
Senem Kumova Metin Spring2009 STACKS AND QUEUES Chapter 10 in A Book on C.
Bubble Sort Algorithm 1.Initialize the size of the list to be sorted to be the actual size of the list. 2.Loop through the list until no element needs.
MATH 224 – Discrete Mathematics
C Structures and Memory Allocation There is no class in C, but we may still want non- homogenous structures –So, we use the struct construct struct for.
Revision.
Stacks CS 3358 – Data Structures. What is a stack? It is an ordered group of homogeneous items of elements. Elements are added to and removed from the.
The N-Queens Problem lab01.
Stack and Queue Dr. Bernard Chen Ph.D. University of Central Arkansas.
Lecture 7 Feb 19 Goals: l subset generation program (related to lab # 3) l applications of stack l Postfix expression evaluation l Convert infix to postfix.
Stacks. 2 What is a stack? A stack is a Last In, First Out (LIFO) data structure Anything added to the stack goes on the “top” of the stack Anything removed.
Stacks (Revised and expanded from CIT 591). What is a stack? A stack is a Last In, First Out (LIFO) data structure Anything added to the stack goes on.
Stacks. 2 What is a stack? A stack is a Last In, First Out (LIFO) data structure Anything added to the stack goes on the “top” of the stack Anything removed.
Stacks. What is a stack? A stack is a Last In, First Out (LIFO) data structure Anything added to the stack goes on the “top” of the stack Anything removed.
Algorithm Efficiency and Sorting
CS 330 Programming Languages 09 / 23 / 2008 Instructor: Michael Eckmann.
Circular List Next field in the last node contains a pointer back to the first node rather than null pointer From any point in such a list it is possible.
30-Jun-15 Stacks. What is a stack? A stack is a Last In, First Out (LIFO) data structure Anything added to the stack goes on the “top” of the stack Anything.
Describing algorithms in pseudo code To describe algorithms we need a language which is: – less formal than programming languages (implementation details.
1 Data Structures and Algorithms Sorting. 2  Sorting is the process of arranging a list of items into a particular order  There must be some value on.
CMSC 202 Lesson 23 Templates II. Warmup Write the templated Swap function _______________________________ void Swap( ________ a, ________ b ) { _______________.
1 C++ Classes and Data Structures Jeffrey S. Childs Chapter 8 Stacks and Queues Jeffrey S. Childs Clarion University of PA © 2008, Prentice Hall.
Main Index Contents 11 Main Index Contents Week 4 – Stacks.
Linked Lists list elements are stored, in memory, in an arbitrary order explicit information (called a link) is used to go from one element to the next.
Chapter 5: Control Structures II (Repetition)
EGR 2261 Unit 5 Control Structures II: Repetition  Read Malik, Chapter 5.  Homework #5 and Lab #5 due next week.  Quiz next week.
Nachos Phase 1 Code -Hints and Comments
While Loops Indefinite Iteration. Last lesson we looked at definite loops using the ‘For’ statement. The while loop keeps going while some condition is.
Chapter 11 Indexing & Hashing. 2 n Sophisticated database access methods n Basic concerns: access/insertion/deletion time, space overhead n Indexing 
224 3/30/98 CSE 143 Recursion [Sections 6.1, ]
Chapter 5: Control Structures II (Repetition). Objectives In this chapter, you will: – Learn about repetition (looping) control structures – Learn how.
Lists, Stacks and Queues in C Yang Zhengwei CSCI2100B Data Structures Tutorial 4.
A grammar for arithmetic expressions involving the four basic operators and parenthesized expressions. Parenthesized expressions have the highest precedence.
Graphs – Part II CS 367 – Introduction to Data Structures.
SFTW241 PROGRAMMING LANGUAGES ARCHITECTURE I Leader : Peter Wong Secretary : Su Project Tracker : Jesse Web Admin : Nelson Liaison : Jacky.
Searching & Sorting Programming 2. Searching Searching is the process of determining if a target item is present in a list of items, and locating it A.
C Programming Week 10 Sorting Algorithms 1. Sorting In many queries we handle a list of values and want a specific value. We can go through all the list.
UNIT 5.  The related activities of sorting, searching and merging are central to many computer applications.  Sorting and merging provide us with a.
Queues. Like Stacks, Queues are a special type of List for storing collections of entities. Stacks are Lists where insertions (pushes) and deletions (pops)
CE 221 Data Structures and Algorithms Chapter 3: Lists, Stacks, and Queues - II Text: Read Weiss, §3.6 1Izmir University of Economics.
1 Chapter 13-2 Applied Arrays: Lists and Strings Dale/Weems.
1 KEEPING POINTERS OR REFERENCES UNDER CONTROL A COMPONENT BASED APPROACH TO LIST BASED DATA STRUCTURES.
Abstract Data Types and Stacks CSE 2320 – Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington 1.
University of Macau Faculty of Science and Technology Programming Languages Architecture SFTW 241 spring 2004 Class B Group 3.
CS 330 Programming Languages 09 / 25 / 2007 Instructor: Michael Eckmann.
Stacks & Queues CSC 172 SPRING 2002 LECTURE 4 Agenda  Stack  Definition  Implementation  Analysis  Queue  Definition  Implementation  Analysis.
Stacks This presentation shows – how to implement the stack – how it can be used in real applications.
CSE 250 – Data Structures. Today’s Goals  First review the easy, simple sorting algorithms  Compare while inserting value into place in the vector 
CE 221 Data Structures and Algorithms Chapter 3: Lists, Stacks, and Queues - II Text: Read Weiss, §3.6 1Izmir University of Economics.
 In general, Queue is line of person waiting for their turn at some service counter like ticket window at cinema hall, at bus stand or at railway station.
Chapter 3 Lists, Stacks, Queues. Abstract Data Types A set of items – Just items, not data types, nothing related to programming code A set of operations.
Chapter 4 Stacks
Popping Items Off a Stack Using a Function Lesson xx
Lists, Stacks and Queues in C
CE 221 Data Structures and Algorithms
CS 201 Data Structures and Algorithms
Dr. Bernard Chen Ph.D. University of Central Arkansas
Stack Lesson xx   This module shows you the basic elements of a type of linked list called a stack.
Stack Memory 2 (also called Call Stack)
Popping Items Off a Stack Lesson xx
Programming Linked Lists.
ADT list.
Abstract Data Types and Stacks
UNIT-II.
Lists.
Stack.
CSCS-200 Data Structure and Algorithms
Stacks.
Stacks, Queues, ListNodes
Presentation transcript:

SFTW241 Group A4 Presentation of Grouping Process

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.

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 )

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.

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.

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 );

/* 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

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

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. */

/* * 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)