1. Given a Data Structure Tree for binary trees (using pointers) to store characters as labels.
#include <stdio.h>
#include <stdlib.h>
#define NULL_NODE NULL
typedef char LabelType;
typedef struct NodeTag {
struct NodeTag *parent;
struct NodeTag *left;
struct NodeTag *right;
LabelType label;
} Node;
typedef Node *Tree; //Tree is a pointer to the root
Please write a function numberOfNodes(n) to compute the number of nodes of the tree with root n.
Prototype
Name: numberOfNodes
Parameter(s):
o n: Tree or Node pointer
Return value: int
Body: computes and returns the number of nodes of the tree with root n.
For example:
Test Result
Node *n0 = (Node*)malloc(sizeof(Node)); n0->label = 'F'; #nodes(F) = 6
Node *n1 = (Node*)malloc(sizeof(Node)); n1->label = 'D'; #nodes(D) = 5
Node *n2 = (Node*)malloc(sizeof(Node)); n2->label = 'E'; #nodes(E) = 4
Node *n3 = (Node*)malloc(sizeof(Node)); n3->label = 'C'; #nodes(C) = 3
Node *n4 = (Node*)malloc(sizeof(Node)); n4->label = 'B'; #nodes(B) = 2
Node *n5 = (Node*)malloc(sizeof(Node)); n5->label = 'A'; #nodes(A) = 1
Test Result
n0->parent = NULL_NODE;
n0->left = n1; n0->right = NULL_NODE;
n1->parent = n0;
n1->left = NULL_NODE; n1->right = n2;
n2->parent = n1;
n2->left = n3; n2->right = NULL_NODE;
n3->parent = n2;
n3->left = NULL_NODE; n3->right = n4;
n4->parent = n3;
n4->left = NULL_NODE; n4->right = n5;
n5->parent = n4;
n5->left = NULL_NODE; n5->right = NULL_NODE;
printf("#nodes(F) = %d\n", numberOfNodes(n0));
printf("#nodes(D) = %d\n", numberOfNodes(n1));
printf("#nodes(E) = %d\n", numberOfNodes(n2));
printf("#nodes(C) = %d\n", numberOfNodes(n3));
printf("#nodes(B) = %d\n", numberOfNodes(n4));
printf("#nodes(A) = %d\n", numberOfNodes(n5));
DCBAEF
Tree T = NULL; #nodes((nil)) = 0
printf("#nodes(%p) = %d\n", T, numberOfNodes(T));
2. Consider a list of students with the following attributes:
name: a string with a maximum of 50 characters.
mark: an integer representing the student's grade.
Such a student list can be represented by a binary search tree in which each node contains two fields
one for the name and one for the mark.
In the binary search tree:
The name is the key used to compare and organize nodes in the tree.
Nodes are inserted based on the lexicographical order (thứ tự ABC) of the names. Specifically:
o If the new student's name is lexicographically smaller than the current node’s name, the
new node is inserted into the left subtree.
o If the new student's name is larger, it is inserted into the right subtree.
This structure ensures that an inorder traversal of the binary search tree will yield the students in
alphabetical order based on their names.
Given a Data Structure StudentBST (a BST tree) to store students and some basic functions.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
char name[50]; //full name
int mark; //mark
} LabelType;
typedef struct NodeTag {
LabelType label;
struct NodeTag *left, *right;
} Node;
typedef Node *StudentBST; //a StudentBST is a pointer to the root of the tree
void printStudents(StudentBST *pT) {
//prints all of students in *pT
Please write a function insert(n, m, pT) to insert a student with name 'n' and mark 'm' into pT.
Prototype
Name: insert
Parameter(s):
o n: char array/char pointer - the student's name
o m: int - the student's mark
o pT: StudentBST pointer - a pointer to root of the StudentBST
Return value: void
Body: insert the student (n, m) into the StudentBST pT.
o If a student with the name n already exists in the tree, print an error message: "The
name has existed.\n".
o After the insertion, the inorder traversal of pT should result in a list of students sorted in
increasing order by name.
Hint
Use strcmp function to compare strings.
Use strcpy function copy strings.
For example:
Test Result
StudentBST studentBST = NULL; Draco Malfoy: 7,
Test Result
insert("Harry Potter", 10, &studentBST); Harry Potter: 10,
insert("Hermione Granger", 8, &studentBST); Hermione Granger: 8,
insert("Draco Malfoy", 7, &studentBST); Luna Lovegood: 8,
insert("Luna Lovegood", 8, &studentBST); Ron Weasley: 9
insert("Ron Weasley", 9, &studentBST); ==END==
The name has existed.
printStudents(&studentBST); Draco Malfoy: 7,
Harry Potter: 10,
insert("Draco Malfoy", 8, &studentBST); Hermione Granger: 8,
Luna Lovegood: 8,
printStudents(&studentBST); Ron Weasley: 9
==END==
StudentBST studentBST = NULL; Dobby: 8
char names[][50] = {"Dobby", ==END==
"Fluffy", Dobby: 8,
"Cedric Diggory", Fluffy: 5
"Lily Potter", ==END==
"Newt Scamander"}; Cedric Diggory: 9,
int marks[] = {8, 5, 9, 8, 6}; Dobby: 8,
int n = 5; Fluffy: 5
for (int i = 0; i < n; i++) { ==END==
insert(names[i], marks[i], &studentBST); Cedric Diggory: 9,
printStudents(&studentBST); Dobby: 8,
} Fluffy: 5,
char new_names[][50] = {"Dobby", Lily Potter: 8
Test Result
"Fluffy", ==END==
"Cedric Diggory", Cedric Diggory: 9,
"Draco Malfoy", Dobby: 8,
"Nagini", Fluffy: 5,
"Cho Chang"}; Lily Potter: 8,
int new_marks[] = {6, 5, 6, 7, 6, 9}; Newt Scamander: 6
for (int i = 0; i < 6; i++) { ==END==
insert(new_names[i], new_marks[i], &studentBST); The name has existed.
} The name has existed.
printStudents(&studentBST); The name has existed.
Cedric Diggory: 9,
Cho Chang: 9,
Dobby: 8,
Draco Malfoy: 7,
Fluffy: 5,
Lily Potter: 8,
Nagini: 6,
Newt Scamander: 6
==END==
3. Consider a list of students with the following attributes:
name: a string with a maximum of 50 characters.
mark: an integer representing the student's grade.
Such a student list can be represented by a binary search tree in which each node contains two fields
one for the name and one for the mark.
In the binary search tree:
The name is the key used to compare and organize nodes in the tree.
Nodes are inserted based on the lexicographical order (thứ tự ABC) of the names. Specifically:
o If the new student's name is lexicographically smaller than the current node’s name, the
new node is inserted into the left subtree.
o If the new student's name is larger, it is inserted into the right subtree.
This structure ensures that an inorder traversal of the binary search tree will yield the students in
alphabetical order based on their names.
Given a Data Structure StudentBST (a BST tree) to store students and some basic functions.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
char name[50]; //full name
int mark; //mark
} LabelType;
typedef struct NodeTag {
LabelType label;
struct NodeTag *left, *right;
} Node;
typedef Node *StudentBST; //a StudentBST is a pointer to the root of the tree
void printStudents(StudentBST *pT) {
//prints all of students in *pT
Please write a function retrieveMark(n, T) to retrieve the mark of the student with the name n from the
binary search tree T.
Prototype
Name: retrieveMark
Parameter(s):
o n: char array or char pointer - the student's name
o T: StudentBST or Node pointer - a pointer to the root of the tree (StudentBST)
Return value: int
Body:
o return the mark of the student with the name n if found in the tree T.
o If the student's name n is not found in the tree, return -802.
Hint
Search for n in the tree.
For example:
Test Result
StudentBST studentBST = NULL; Mark of Harry Potter is 10
insert("Harry Potter", 10, &studentBST); Mark of Ginny Weasley is -
802
insert("Hermione Granger", 8, &studentBST);
Mark of Draco Malfoy is 7
insert("Draco Malfoy", 7, &studentBST);
Mark of Draco Malfoy is -
insert("Luna Lovegood", 8, &studentBST);
Test Result
insert("Ron Weasley", 9, &studentBST); 802
printf("Mark of %s is %d\n", "Harry Potter", retrieveMark("Harry
Potter", studentBST));
printf("Mark of %s is %d\n", "Ginny Weasley", retrieveMark("Ginny
Weasley", studentBST));
printf("Mark of %s is %d\n", "Draco Malfoy", retrieveMark("Draco
Malfoy", studentBST));
printf("Mark of %s is %d\n", "Draco Malfoy", retrieveMark("Draco
Malfoy", studentBST));
StudentBST studentBST = NULL; Mark of Bellatrix Lestrange
is 7
char names[][50] = {"Bellatrix Lestrange",
Mark of Lord Voldemort is 9
"Lord Voldemort",
Mark of Rubeus Hagrid is 5
"Rubeus Hagrid",
Mark of Dudley Dursley is 9
"Dudley Dursley",
Mark of Dolores Umbridge
"Dolores Umbridge"};
is 9
int marks[] = {7, 9, 5, 9, 9};
Mark of Peeves is -802
int n = 5;
Mark of Hermione Granger
for (int i = 0; i < n; i++) { is -802
insert(names[i], marks[i], &studentBST); Mark of Nymphadora Tonks
is -802
}
char new_names[][50] = {"Bellatrix Lestrange",
"Lord Voldemort",
"Rubeus Hagrid",
"Dudley Dursley",
"Dolores Umbridge",
Test Result
"Peeves",
"Hermione Granger",
"Nymphadora Tonks"};
for (int i = 0; i < n + 3; i++)
printf("Mark of %s is %d\n", new_names[i],
retrieveMark(new_names[i], studentBST));
Answer:(penalty regime: 1, 2, ... %)
4. Consider a list of students with the following attributes:
name: a string with a maximum of 50 characters.
mark: an integer representing the student's grade.
Such a student list can be represented by a binary search tree in which each node contains two fields
one for the name and one for the mark.
In the binary search tree:
The name is the key used to compare and organize nodes in the tree.
Nodes are inserted based on the lexicographical order (thứ tự ABC) of the names. Specifically:
o If the new student's name is lexicographically smaller than the current node’s name, the
new node is inserted into the left subtree.
o If the new student's name is larger, it is inserted into the right subtree.
This structure ensures that an inorder traversal of the binary search tree will yield the students in
alphabetical order based on their names.
Given a Data Structure StudentBST (a BST tree) to store students and some basic functions.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
char name[50]; //full name
int mark; //mark
} LabelType;
typedef struct NodeTag {
LabelType label;
struct NodeTag *left, *right;
} Node;
typedef Node *StudentBST; //a StudentBST is a pointer to the root of the tree
void printStudents(StudentBST *pT) {
//prints all of students in *pT
Please write a function countByMark(v, T) to count the number of students having a mark greater than
or equal to v in the tree T.
Prototype
Name: countByMark
Parameter(s):
o v: int - the threshold mark value
o T: StudentBST or Node pointer - a pointer to the root of the tree (StudentBST)
Return value: int
Body:
o return the count of students who have a mark greater than or equal to v in the tree T.
Hint
Traverse the binary search tree T, comparing the marks of each student with the value v.
For example:
Test Result
StudentBST studentBST = NULL; The number of students having
mark >= 9 is 2
insert("Harry Potter", 10, &studentBST);
The number of students having
insert("Hermione Granger", 8, &studentBST);
mark >= 8 is 4
insert("Draco Malfoy", 7, &studentBST);
The number of students having
insert("Luna Lovegood", 8, &studentBST); mark >= 7 is 5
insert("Ron Weasley", 9, &studentBST); The number of students having
mark >= 6 is 5
printf("The number of students having mark >= %d is %d\n", 9,
countByMark(9, studentBST));
printf("The number of students having mark >= %d is %d\n", 8,
countByMark(8, studentBST));
printf("The number of students having mark >= %d is %d\n", 7,
countByMark(7, studentBST));
printf("The number of students having mark >= %d is %d\n", 6,
countByMark(6, studentBST));
StudentBST studentBST = NULL; The number of students having
mark >= 0 is 5
char names[][50] = {"Dudley Dursley",
The number of students having
"Nagini",
mark >= 1 is 5
"Dolores Umbridge",
The number of students having
"Narcissa Malfoy", mark >= 2 is 5
The number of students having
Test Result
"Professor Albus Dumbledore"}; mark >= 3 is 5
int marks[] = {8, 8, 7, 9, 5}; The number of students having
mark >= 4 is 5
int n = 5;
The number of students having
for (int i = 0; i < n; i++) {
mark >= 5 is 5
insert(names[i], marks[i], &studentBST);
The number of students having
} mark >= 6 is 4
for (int v = 0; v < 12; v++) The number of students having
mark >= 7 is 4
printf("The number of students having mark >= %d is %d\n", v,
countByMark(v, studentBST)); The number of students having
mark >= 8 is 3
The number of students having
mark >= 9 is 1
The number of students having
mark >= 10 is 0
The number of students having
mark >= 11 is 0
Answer:(penalty regime: 1, 2, ... %)
5. Consider a list of students with the following attributes:
name: a string with a maximum of 50 characters.
mark: an integer representing the student's grade.
Such a student list can be represented by a binary search tree in which each node contains two fields
one for the name and one for the mark.
In the binary search tree:
The name is the key used to compare and organize nodes in the tree.
Nodes are inserted based on the lexicographical order (thứ tự ABC) of the names. Specifically:
o If the new student's name is lexicographically smaller than the current node’s name, the
new node is inserted into the left subtree.
o If the new student's name is larger, it is inserted into the right subtree.
This structure ensures that an inorder traversal of the binary search tree will yield the students in
alphabetical order based on their names.
Given a Data Structure StudentBST (a BST tree) to store students and some basic functions.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
char name[50]; //full name
int mark; //mark
} LabelType;
typedef struct NodeTag {
LabelType label;
struct NodeTag *left, *right;
} Node;
typedef Node *StudentBST; //a StudentBST is a pointer to the root of the tree
void insert(char *name, int mark, StudentBST *pT) {
//insert the student (name, mark) into tree *pT
void printStudents(StudentBST *pT) {
//prints all of students in *pT
Please write a function filterByMark(v, T) to create a new tree containing students who have a mark
greater than v in the tree T.
Prototype
Name: filterByMark
Parameter(s):
o v: int - the threshold mark value
o T: StudentBST or Node pointer - a pointer to the root of the tree (StudentBST)
Return value: StudentBST or Node pointer
Body:
o return a new StudentBST that contains only the students from the original tree T who
have a mark greater than v.
Hint
Make null the result
Traverse the binary search tree T (using a modified version of preorder/inorder/postorder), and
for each student whose mark is greater than v, insert them into the new tree (using insert
function).
For example:
Test Result
StudentBST studentBST = NULL; **Original tree:**
insert("Harry Potter", 10, &studentBST); Draco Malfoy: 7,
insert("Hermione Granger", 8, &studentBST); Harry Potter: 10,
insert("Draco Malfoy", 7, &studentBST); Hermione Granger: 8,
insert("Luna Lovegood", 8, &studentBST); Luna Lovegood: 8,
insert("Ron Weasley", 9, &studentBST); Ron Weasley: 9
==END==
printf("**Original tree:**\n");
printStudents(&studentBST); **Filtered tree:**
Harry Potter: 10,
StudentBST newTree = filterByMark(8, studentBST); Hermione Granger: 8,
printf("\n**Filtered tree:**\n"); Luna Lovegood: 8,
printStudents(&newTree); Ron Weasley: 9
==END==
printf("\n**Original tree:**\n");
printStudents(&studentBST); **Original tree:**
Draco Malfoy: 7,
StudentBST newTree1 = filterByMark(11, studentBST); Harry Potter: 10,
printf("\n**Filtered tree with 11:**\n"); Hermione Granger: 8,
printStudents(&newTree1); Luna Lovegood: 8,
Ron Weasley: 9
==END==
**Filtered tree with 11:**
==END==
Test Result
StudentBST studentBST = NULL; Dolores Umbridge: 1,
char names[][50] = {"Dolores Umbridge", Gilderoy Lockhart: 2,
"Gilderoy Lockhart", Hedwig: 9,
"Hedwig", Hermione Granger: 8,
"Sirius Black", Sirius Black: 4
"Hermione Granger"}; ==END==
int marks[] = {1, 2, 9, 4, 8}; After filter with mark 11:
int n = 5; ==END==
for (int i = 0; i < n; i++) {
insert(names[i], marks[i], &studentBST);
printStudents(&studentBST);
printf("After filter with mark 11:\n");
StudentBST filteredTree = filterByMark(11,
studentBST);
printStudents(&filteredTree);
Answer:(penalty regime: 1, 2, ... %)
6. Given a Data Structure Tree for binary trees (using pointers) to store characters as labels.
#include <stdio.h>
#include <stdlib.h>
#define NULL_NODE NULL
typedef char LabelType;
typedef struct NodeTag {
struct NodeT-ag *parent;
struct NodeTag *left;
struct NodeTag *right;
LabelType label;
} Node;
typedef Node *Tree; //Tree is a pointer to the root
Please write a function copyTree(T1, T2) to make a copy of T2 and store the result in T1.
Prototype
Name: copyTree
Parameter(s):
o pT1: Tree pointer
o T2: Tree or Node pointer
Return value: void
Body: makes a copy of tree T2 and stores the result in pT1
Hint
Create the root node
Copy left subtree
Copy right subtree
For example:
Test Result
Node *n0 = (Node*)malloc(sizeof(Node)); n0->label = 'D'; T1 = D F C A E B
Node *n1 = (Node*)malloc(sizeof(Node)); n1->label = 'F'; T2 = D F C A E B
Node *n2 = (Node*)malloc(sizeof(Node)); n2->label = 'C'; T1 = D F C A E B
Node *n3 = (Node*)malloc(sizeof(Node)); n3->label = 'A'; T2 = A B C D E F
Node *n4 = (Node*)malloc(sizeof(Node)); n4->label = 'E';
Test Result
Node *n5 = (Node*)malloc(sizeof(Node)); n5->label = 'B';
n0->parent = NULL_NODE;
n0->left = n1; n0->right = NULL_NODE;
n1->parent = n0;
n1->left = NULL_NODE; n1->right = n2;
n2->parent = n1;
n2->left = NULL_NODE; n2->right = n3;
n3->parent = n2;
n3->left = n4; n3->right = NULL_NODE;
n4->parent = n3;
n4->left = NULL_NODE; n4->right = n5;
n5->parent = n4;
n5->left = NULL_NODE; n5->right = NULL_NODE;
Tree T2 = n0;
Tree T1;
copyTree(&T1, T2);
printf("T1 = "); preorder(T1); printf("\n");
printf("T2 = "); preorder(T2); printf("\n");
n0->label = 'A';
n1->label = 'B';
n2->label = 'C';
n3->label = 'D';
n4->label = 'E';
n5->label = 'F';
printf("T1 = "); preorder(T1); printf("\n");
Test Result
printf("T2 = "); preorder(T2); printf("\n");
BCEFDA
Answer:(penalty regime: 1, 2, ... %)
7. In mathematics, there are four basic arithmetic operators: addition ('+'), subtraction('-'), multiplication
('*'), and division (':').
The associative property does not apply to subtraction. This means the order in which we group
numbers matters. For example, (a−b)−c≠a−(b−c)(a−b)−c≠a−(b−c). Instead, (a−b)−c=a−(b+c)(a−b)−c=a−
(b+c), for example:
(12−3)−2=12−(3+2)(12−3)−2=12−(3+2)
Let's call this as pseudo associative property for subtraction.
Given a Data Structure Tree (using pointers) to represent expressions.
#define NULL_NODE NULL
typedef char LabelType;
typedef struct NodeTag {
struct NodeTag *left;
struct NodeTag *right;
LabelType label;
} Node;
typedef Node *Tree; //Tree is a pointer to the root
Please write a function transformWithPseudoAssociativity(r) to transform a tree with root r,
representing (a−b)−c(a−b)−c, into one representing a−(b+c)a−(b+c) using the pseudo associative
property.
Prototype
Name: transformWithPseudoAssociativity
Parameter(s):
o r: Node pointer - root of the tree
Return value: void
Body: transform a tree with root r, representing (a−b)−c(a−b)−c, into one representing a−
(b+c)a−(b+c). Note that a, b, c may be subtrees, not just leaves.
Hint
Locate a, b, c, for example: a = n->left->left
Relink nodes
Change label of some nodes.
Tree rotation is an operation on a binary tree that changes the structure without interfering with the
order of the elements. A tree rotation moves one node up in the tree and one node down. It is used to
change the shape of the tree, and in particular to decrease its height by moving smaller subtrees down
and larger subtrees up, resulting in improved performance of many tree operations..
The tree rotation renders the inorder traversal of the binary tree invariant. This implies the order of the
elements is not affected when a rotation is performed in any part of the tree. This property is very useful
for binary search trees.
Given a Data Structure Tree (using pointers) to store integers.
#define NULL_NODE NULL
typedef int LabelType;
typedef struct NodeTag {
struct NodeTag *left;
struct NodeTag *right;
LabelType label;
} Node;
typedef Node *Tree; //Tree is a pointer to the root
Please write a function rotate(r) to perform a right rotation on a tree with root r.
Prototype
Name: rotate
Parameter(s):
o r: Node pointer - root of the tree
Return value: Node pointer
Body: right rotate the tree with root r, and return the new root node.
Hint
Locate subtrees A,B,α,β,γA,B,α,β,γ.
Relink nodes.
Do not change labels of nodes.
Consider a list of students with the following attributes:
name: a string with a maximum of 50 characters.
mark: an integer representing the student's grade.
Such a student list can be represented by a binary search tree in which each node contains two fields
one for the name and one for the mark.
In the binary search tree:
The name is the key used to compare and organize nodes in the tree.
Nodes are inserted based on the lexicographical order (thứ tự ABC) of the names. Specifically:
o If the new student's name is lexicographically smaller than the current node’s name, the
new node is inserted into the left subtree.
o If the new student's name is larger, it is inserted into the right subtree.
This structure ensures that an inorder traversal of the binary search tree will yield the students in
alphabetical order based on their names.
Given a Data Structure StudentBST (a BST tree) to store students and some basic functions.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
char name[50]; //full name
int mark; //mark
} LabelType;
typedef struct NodeTag {
LabelType label;
struct NodeTag *left, *right;
} Node;
typedef Node *StudentBST; //a StudentBST is a pointer to the root of the tree
void insert(char *n, int m, StudentBST *pT) {
//insert student with name n and mark m into *pT
Please write a function printStudents(T) that prints the names and marks of all students stored in a tree
T, sorted by their names in alphabetical order. Each student's name and mark should be printed on a new
line in the following format:
<student_name>: <mark>,
<student_name>: <mark>,
...
<student_name>: <mark>
==END==
After all the students' names and marks have been printed, output ==END== on a new line, for example:
Harry Potter: 10,
Hermione Granger: 8,
Luna Lovegood: 9
==END==
Prototype
Name: printStudents
Parameter(s):
o T: StudentBST (or Node pointer) - a pointer to root of the StudentBST
Return value: void
Body: print the names and marks of all students stored in a tree T, sorted by their names in
alphabetical order.
Hint
Write a supplementary recursive function to print node in inorder traversal.
You can use a global variable "first" to determine when the first element is printed.
For example:
Test Result
StudentBST studentBST = NULL; Draco Malfoy: 7,
insert("Harry Potter", 10, &studentBST); Harry Potter: 10,
insert("Hermione Granger", 8, &studentBST); Hermione Granger: 8,
insert("Draco Malfoy", 7, &studentBST); Luna Lovegood: 8,
insert("Luna Lovegood", 8, &studentBST); Ron Weasley: 9
insert("Ron Weasley", 9, &studentBST); ==END==
Draco Malfoy: 7,
printStudents(studentBST); Harry Potter: 10,
printStudents(studentBST); Hermione Granger: 8,
Luna Lovegood: 8,
Ron Weasley: 9
==END==
StudentBST studentBST = NULL; Rubeus Hagrid: 6
char names[][50] = {"Rubeus Hagrid", ==END==
"Lord Voldemort", Lord Voldemort: 9,
"Pansy Parkinson", Rubeus Hagrid: 6
"Sirius Black", ==END==
"Moaning Myrtle"}; Lord Voldemort: 9,
int marks[] = {6, 9, 9, 6, 7}; Pansy Parkinson: 9,
Test Result
int n = 5; Rubeus Hagrid: 6
for (int i = 0; i < n; i++) { ==END==
insert(names[i], marks[i], &studentBST); Lord Voldemort: 9,
printStudents(studentBST); Pansy Parkinson: 9,
} Rubeus Hagrid: 6,
Sirius Black: 6
==END==
Lord Voldemort: 9,
Moaning Myrtle: 7,
Pansy Parkinson: 9,
Rubeus Hagrid: 6,
Sirius Black: 6
==END==
Answer:(penalty regime: 1, 2, ... %)