Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Data structure- algorithm Expand the BST implementation we had in class, by implementing the following extra functions: 1) (20 points) write a function T next

Data structure- algorithm image text in transcribed
Expand the BST implementation we had in class, by implementing the following extra functions: 1) (20 points) write a function T next (TNode P) that returns the successor of the node that is pointed by P based on in-order traversal. 2) (20 points) Write a function void print_level (int level) that prints all the nodes at the input level. If the level does not exist, output a proper error message. 3) (30 points) write a function bool isBSTO), which returns true if the current binary tree is a BST, and false otherwise. Note that: checking whether every node contains a value larger than its left child and smaller than its right child .... Does not work for all cases 4) (30 points) write a function TLCS(T& a, T& b) that returns the smallest common ancestor of two nodes in a BST. If the tree is empty, or if it has less than three nodes, it returns -1. For example the LCS(6,12) = 10 10

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

Step: 3

blur-text-image

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

Strategic Database Technology Management For The Year 2000

Authors: Alan Simon

1st Edition

155860264X, 978-1558602649

Students also viewed these Databases questions

Question

How to find if any no. is divisble by 4 or not ?

Answered: 1 week ago

Question

Explain the Pascals Law ?

Answered: 1 week ago

Question

What are the objectives of performance appraisal ?

Answered: 1 week ago