Question
Consider the following Java-like pseudo-code for inserting a node into a Binary Search Tree (BS
- T : ```java class Node { int data; Node left, right; public Node(int item) { data = item; left = right = null; } } class BST { Node root; BST() { root = null; } void insert(int data) { root = insertRec(root, data); } Node insertRec(Node root, int data) { if (root == null) { root = new Node(data); return root; } if (data < root.data) { root.left = insertRec(root.left, data); } else if (data > root.data) { root.right = insertRec(root.right, data); } // If data == root.data, do nothing (assume no duplicates) return root; } } ``` If you insert the following sequence of numbers into an initially empty BST: `50, 30, 70, 20, 40, 60, 80`, what will be the data of the node that has `40` as its right child?
More IT DBMS Questions
- In a program that manages a collection of `Employee` objects, each with a `salary` attribute, which control flow mechanism would be most efficient to find ...
- Which of the following is a type of database index?
- What is the output of the following pseudo-code? ``` count = 0 for i from 1 to 3: for j from 1 to i: count = count + 1 ...
- Shadow Paging avoids:
- Which system call is used to create a new process in UNIX/Linux?
- To remove all rows from a table without logging individual row deletions and without firing triggers, which command would you typically use?
- Indexes improve query performance but can degrade performance of:
- Which of the following is a type of phishing attack?
- Which of the following is used to remove all records from a table without removing the table structure?
- Which of the following is NOT a common type of error encountered during software development?
Hey! Ask a query
Please enter email id
The email must be a valid email address.
Please enter Mobile Number
Please enter valid Mobile Number
Please enter your Doubt