In this program you are to implement a database of student records, using the binary search tree abstract data type, implemented as a linked list. There is a lot of code on the internet. Please do not simply copy the code already developed by other programmers. Write your own code. The student record will have the following format:

typedef struct studentRec{
int id;
char[] name; //the name has a maximum length of 25 letters
char[] major; //the major array has a max length of 15
int year;
}

You are required to maintain the database by providing the following functionality:

  • Search to see if a record exists in the data base
  • Add a record to the database;
  • Delete a record from the database
  • Update a record in the database
  • Print out all of the records in the database
  • Print out all of the records in the database from a given point

Objectives:

The objective of this assignment is for students to demonstrate a working knowledge of :

  • Binary Search Trees
  • Linked list implementation of BST
  • BST operations

Requirements:

Your program should demonstrate the 6 functionalities described above. These should be implemented as the following functions:

  • initBST: In this function your program should read an input file to obtain the student records then your BST should be populated by adding each of these records to the BST. Your function should return a pointer to the root of the BST. Do not hardcode the name of your input file in your program. It should be a parameter passed to main.
  • Search: This function takes a pointer to the BST, and an integer parameter. It searches the BST for the student with that Id. If the record is found it prints out the record and the function returns 1 otherwise it returns 0;
  • addNode: This function takes a pointer to the BST, an integer, two char arrays and a second integer. It creates a new node and then adds that node in place to the BST and returns a pointer to the modified BST.
  • updateStudent: This function takes a pointer to the BST and two integers. It finds the student whose id is the first integer and updates the year value to the second integer parameter and returns a pointer to the updated BSGT.
  • deleteStudent: This function takes a pointer to the BST, and the integer id of a student, finds that student record, deletes it (using the predecessor method) and returns the updated BST.
  • print: This function takes a pointer to the BST and prints out all of the student records stored in table form – as shown in the sample output
  • printFrom: This function takes a pointer to the BST and an integer and prints out all of the student records stored in the BST from that node to all of its sub-trees. The values are printed in table form – as shown in the sample output

When your program is run, it should read input from an input file one line at a time. Each line will contain an integer, followed by two char arrays and then a second integer. Your program should continue to read the input file, until a line beginning with the number 0 is encountered. The data in the input file will be used to initialize the BST. The name of your input file will be passed as an argument to main so it should not be hardcoded in your program

It should then provide a menu of choices 2-7 to the user. This allows a software testing team to test your other functions. Your program should repeat the menu display until the user selects the option 0 which means to Quit.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.