Functions used
node* input(node*)
void arrayToZero(college[])
node* generatePQueue(node*, node*, char)
college collegeAllocator(college, node**, node**, node**)
node* aipoq(college[])
node* generateBST(node*, node*)
void displayAll(node*)
void displayStudent(node*)
void displayCollege(college[])
void nukeTree(node*)
void nukeQUeue(node*)
node* deleteStudents(node*)
The program reads student data from a binary file using the input()
function and generates a Doubly Linked List and return the first node of the list.
parameters:
- doubly linked list variable
Initilizes the pupils
field of a[]
to NULL
.
parameters:
- college array
Takes every category list (A1
,B2
and GM
) and converts it into one big priory queue according to their rank
and returns the starting node of the priority queue.
parameters:
- starting node of category list
- starting node of final list
- character to compare the
cat[]
field of the node
Function to allocate colleges to the students and store it in Doubly Linked List and returns the same.
Each college has 25 seats, divided as follows
- 8
A1
seats - 8
B2
seats - 9
GM
seats
working:
while(count<A1SEATS && (*A1)){
dQed=malloc(sizeof(node));
dQed->uid=(*A1)->uid;
strcpy(dQed->name,(*A1)->name);
strcpy(dQed->cat,(*A1)->cat);
dQed->rank=(*A1)->rank;
strcpy(dQed->clg,c.name);
(c.pupils)[count]=dQed;
nuker=(*A1);
(*A1)=(*A1)->rptr;
free(nuker);
count++;
}
deques nodes from A1
and adds into the college list c
similar process happens with B2
and GM
.
parameters:
- college list
A1
category listB2
category listGM
category list
aiopq()
aka All In One Prioriy Queue.
This function generates a big Priory Queue consisting all the student sorted accoring to thier rank
, the function returns the starting node of this priority queue.
parameters:
- college array
a[]
Generates a Binary Search Tree taking the sorted list generated by aipoq()
as input. Binary search tree provides faster access time of nodes. The Binary Search Tree uses uid
to insert the elements into the tree. Returns the root of the tree.
parameters:
- root of the binary search tree
- starting node of the doubly linked list
This funcition displays all the elements in the priory Queue in ascending order or rank.
parameters:
- priory queue which has to be displayed
This funtion displays details of just the entered student. The node is search from the binary search tree generated by generateBST()
.
parameters:
- root of binary search tree to be searched from
Function to display students in a particular college.
parameters:
- college array
Function to free every node form the binary search tree to avoid memeory lekage.
parameters:
- root of the BST
Function to free every node from the queue to avoid memory lekage.
parameters:
- starting node of the queue
Deletes the students who have withdrawn from the list.
parameters:
- list form which the nodes have to be deleted