Page 1 of 1

2. BST (52) The wizards of Hogwarts have lost their memory. All they have is a badge with their first and last name and

Posted: Sat May 14, 2022 7:27 pm
by answerhappygod
2 Bst 52 The Wizards Of Hogwarts Have Lost Their Memory All They Have Is A Badge With Their First And Last Name And 1
2 Bst 52 The Wizards Of Hogwarts Have Lost Their Memory All They Have Is A Badge With Their First And Last Name And 1 (134.68 KiB) Viewed 34 times
2. BST (52) The wizards of Hogwarts have lost their memory. All they have is a badge with their first and last name and score. Help them remember which of the 4 houses they belong to. (1p) Create a Wizard class with the fields last name, first name, score, house. Add the necessary constructors and methods. (0.5p) Create several Wizard objects and add them to a BST. When you press different options (1, 2, 3, 4, 5), you have to do the following operations: 1. (0.25p) Display the wizards sorted in ascending order by their score 2.(0.25p) Display the total score of a house (we enter key 2 and the name of the house) 3. (1p) Display each member of a Hogwarts house grouped by category and update each person's "house" field, using the bst. - if the score is between 0 and 5000, the house is Hufflepuff - if the score is between 5000 and 20000, the house is Gryffindor - if the score is between 20000 and 50000, the house is Ravenclaw - if the score is >50000, the house is Slytherin. For example, we will display: - Hufflepuff House: Cedric Diggory, 2000 - Gryffindor House: Harry Potter, 10000; Hermione Granger, 17000 - Ravenclaw House: Luna Lovegood, 31000 - House Slytherin: Draco Malfoy, 60000; Severus Snape, 150,000. 4. (1p) Congratulations :) Now we can play Quidditch. But the game can take place only if the set of wizards is complete. The set is said to be complete if all the nodes of the tree have zero or two children. 5. (0.5p) Given a sequence of scores in ascending order which represent the players, check if this sequence exists and if so, display the names of the players in ascending order as well. Attention! You cannot use any other auxiliary data structure, only an array with the sequence read and the binary tree. Example 1: 2000, 10000, 31000, 60000 will display: Yes: Cedric Diggory, Harry Potter, Luna Lovegood, Draco Malfoy Example 2: 2000, 31000, 10000, 60000 will display: No //(or wrong order) Example 3: 2000, 31000, 45000, 60000 will display: No //(because 45000 does not exist) The interactive menu with options: 0.5p