/CETalloc

DS mini project to have CET rank allocater.

Primary LanguageC

CET college allocation program

Functions used

input()

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

arrayToZero()

Initilizes the pupils field of a[] to NULL.

parameters:

  • college array

generatePQueue()

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

collegeAllocator()

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 list
  • B2 category list
  • GM category list

aipoq()

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[]

generateBST()

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

displayAll()

This funcition displays all the elements in the priory Queue in ascending order or rank.

parameters:

  • priory queue which has to be displayed

displayStudent()

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

displayCollege()

Function to display students in a particular college.

parameters:

  • college array

nukeTree()

Function to free every node form the binary search tree to avoid memeory lekage.

parameters:

  • root of the BST

nukeQUeue()

Function to free every node from the queue to avoid memory lekage.

parameters:

  • starting node of the queue

deleteStudents()

Deletes the students who have withdrawn from the list.

parameters:

  • list form which the nodes have to be deleted