Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

int number_to_shortlist(shared_ptr> root) Returns the total number of applicants you can shortlist: CODE IS GIVEN BELOW vector in_order(shared_ptr> root) Returns an array of keys traversed

int number_to_shortlist(shared_ptr> root) Returns the total number of applicants you can shortlist: CODE IS GIVEN BELOW

vector in_order(shared_ptr> root) Returns an array of keys traversed in-order from the root. Note that you can only shortlist a limited number of applicants; therefore, you need to return the same amount of keys as the number of applicants that can be shortlisted.

vector level_order(shared_ptr> root) Returns a list of keys traversed in level-order from the root. Note that you can only shortlist a limited number of applicants; therefore, you need to return the same amount of keys as the number of applicants that can be shortlisted.

CODE in order and level order while keeping the maximum number of applicants that can be shortlisted using the numbertoshortlist function in mind and return the inorder and levelorder vector for both. code this in c++

starter code:

template

int AVL :: number_to_shortlist (shared_ptr> root){

if (root == nullptr){

return 0;

}

return 1 + number_to_shortlist(root->right);

}

template

struct node {

S fullName;

T workExperience;

string gender;

shared_ptr left;

shared_ptr right;

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> root;

bool isAVL;

public:

AVL(bool);

void insertNode(shared_ptr>);

void deleteNode(T k);

shared_ptr>getRoot();

shared_ptr>searchNode(T k);

int height (shared_ptr > p);

// Part 3 Functions

int number_to_shortlist(shared_ptr> root);

vector right_most(shared_ptr> root);

vector in_order(shared_ptr> root);

vector level_order(shared_ptr> root);

vector bias(shared_ptr> root);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students explore these related Databases questions