Implemntation of Bucket sort for a list of faculties
This program employs the Bucket / Radix sort method to sort a list of
faculty member records taking their IDs as the key.
Created using Turbo C++ IDE (version 8.0) for Windows system.
It first reads the rerords of faculty members from a text file of predified
format and keeps them in a linked list. Then they are sorted by using 10 queues
(befause radix of the keys is 10). But to do so each of the quees do not take
extra memory to hold the records. Rather it creates only a chain of records in
the form of linked list. ie., it extracts the nodes from the linked list of
records and merely recreates a chain.
So, the sorting algo has time complexity of T(n) = m * lg(n), where n is
number of records and
m = maximum number of digits in each key.
It has a space complexity of only O(n), in spite of taking 10 queues.
This program shows uses following things :
1. Text file handling.
2. Singly linear linked list.
3. Dynamic allocation of memory.
4. Linked list implemented Queue.
5. Radix sorting.
The list of Faculty members are contained in a file (Teachers.txt) as
<ID>|<Subject Code> <Class> <Teacher Name>
The list of Subjects are contained in a file (Subects.txt) as
<Subject Code> <Subject Name>
Run the program with the Teachers and Subjects text files as command line
followng example :
BucktSrt c:\data\Teachers.txt c:\data\Subjects.txt
If the paths to the text files are not provided, they will be assumed to be
current folder of the program.
If the subject file is not found then the subjects are printed as 'null'
after issing and error message.
If the faculty member file is not found then the program aborts issuing
Following things can be changed:
1. The number of rows in the output screen (stored the symbolic constant
2. Maximum number of digits in each ID (stored in the symbolic constant
MAXDIGITS). But since
the ID is of type int, it is good to stay with 4.
3. Maximum number of subjects in the Subject table (stored in symbolic