Question: vector bias(shared_ptr> root) For every node in the tree, compute the ratio of Females to Males in the left subtree of that node. The function
vector bias(shared_ptr> root) For every node in the tree, compute the ratio of Females to Males in the left subtree of that node. The function should return a vector which contains the ratios computed for all nodes, where the order of these ratios is the same as the level order traversal of the tree. (Simply put, the vector of ratios should be ordered the same way as the level-order traversal of the tree).
Code in c++.
Starter Code:
template
struct node {
S fullName;
T workExperience;
string gender;
shared_ptr
shared_ptr
int height;
node(T w, S n, C g) {
this->fullName = n;
this->workExperience = w;
this->gender = g;
left = NULL;
right = NULL;
height = 1;
}
};
// AVL Class (This will be used for both BST and AVL Tree implementation)
template
class AVL {
shared_ptr
bool isAVL;
public:
AVL(bool);
void insertNode(shared_ptr
void deleteNode(T k);
shared_ptr
shared_ptr
int height (shared_ptr
// Part 3 Functions
int number_to_shortlist(shared_ptr
vector
vector
vector
vector
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
