The Computer Science Department would like to decide which courses to offer for
ID: 3633400 • Letter: T
Question
The Computer Science Department would like to decide which courses to offer for the next semester and would like to offer only the courses that are in demand by the students. Write a program to allow the students to input the courses that they would like to take the next semester. The first time a course is submitted by a student, the course comes into existence and a counter for the course is set to 1 (showing that one student is interesting in taking the course). If the course already exists and a student would like for the course to be offered, the counter for the course is incremented. Display the course numbers (from smallest to largest) with corresponding counters. Remove the courses with only one student interested in taking the course. Display the course numbers (from smallest to largest) with corresponding counters after courses with one interested student have been deleted.Programming Guidelines:
Use a binary search tree to store the information on the courses. Use the appropriate binary tree traversal that will give you the correct output. If there are more than 5 courses requested.
Use the following definition for the binary search tree:
typedef int ElementType;
class node
{
friend class BinarySearchTree;
private:
ElementType data;
node * leftchild;
node * rightchild;
};
class BinarySearchTree
{
public:
BinarySearchTree();
bool empty(); // return true if the tree is empty, otherwise return false
bool Insert(ElementType x);//insert a value x
bool IsThere (ElementType x);
//return true if x is in the tree, otherwise return false
void Delete(ElementType x); //if value x is in the tree, remove x
void Display();// Display the data values stored from smallest to largest
private:
node * root;//pointer to the roor node
};
Sample input:
285
280
163
165
476
365
163
280
280
165
365
365
165
280
476
163
163
385
Sample output:
List of all courses:
163 – 4
165 – 3
280 – 4
285 – 1
365 – 3
385 – 1
476 – 2
List of courses more than one student interested:
163 – 4
165 – 3
280 – 4
365 – 3
476 – 2
Explanation / Answer
check the following links... http://www.codemiles.com/c-examples/binary-search-tree-c-t7368.html http://cprogramminglanguage.net/binary-search-tree-c-code.aspx http://cprogramminglanguage.net/avl-tree.aspx the free registration is required in the later 2 links.....ok thx
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.