0 évaluation0% ont trouvé ce document utile (0 vote)
7 vues1 page
This document contains an assignment for a data structures and algorithms course. It has 3 questions - the first asks to write a function for preorder traversal in a binary search tree, the second asks to write a function to find the maximum value in a BST, and the third asks questions about a sample binary tree including identifying the root node, depth, leaf nodes, and providing preorder, inorder and postorder expressions for the tree.
This document contains an assignment for a data structures and algorithms course. It has 3 questions - the first asks to write a function for preorder traversal in a binary search tree, the second asks to write a function to find the maximum value in a BST, and the third asks questions about a sample binary tree including identifying the root node, depth, leaf nodes, and providing preorder, inorder and postorder expressions for the tree.
This document contains an assignment for a data structures and algorithms course. It has 3 questions - the first asks to write a function for preorder traversal in a binary search tree, the second asks to write a function to find the maximum value in a BST, and the third asks questions about a sample binary tree including identifying the root node, depth, leaf nodes, and providing preorder, inorder and postorder expressions for the tree.
Q1. Write a function for preorder traversal in a BST.
(5 marks)
void preorder(TNode * root){
// Your code } Q2. Write a code to find the maximum value in a BST.
(5 marks)
void max(TNode * root ){
// Your code } Q3. 1+1+2+6)
(Marks:
For the tree in Figure below:
Q1. Which node is the root? Q2. What is the depth of the tree? Q3. Which nodes are leaves? Q4. Give the preorder, inorder, and postorder expressions corresponding to the tree.