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
- A relation is decomposed into R1(A,B) and R2(B,C). Which condition guarantees a lossless join for a binary decomposition?
- Which SQL keyword is used to combine the result sets of two or more SELECT statements, automatically removing duplicate rows from the combined result?
- Which type of DBMS model organizes data in tables with rows and columns?
- Given the following Python-like code snippet: ```python class Counter: def __init__(self): self.count = 0 def in...
- In PL/SQL, a `CURSOR` is used to:
- A relation is in 1NF (First Normal Form) if:
- A table T(A,B,C) has functional dependencies A→B and B→C. Which statement about A is necessarily true?
- Which of the following best describes the control flow when a method in a subclass overrides a method in its superclass, and an object of the subclass is r...
- What is the maximum number of processes that can be in the Ready state?
- Which normal form eliminates transitive dependencies?
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
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
- 200 Questions with Detailed Solutions
- Section-wise Coverage (GA, English, Quant & Reasoning)