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
- If every non-key attribute is functionally dependent on the primary key, the relation will be in
- A 'Dependent' entity (e.g., an employee's dependents) has no standalone primary key and always depends on 'Employee' for identification. When converting th...
- A relation R(A, B, C, D) has the functional dependencies AB → C, C → D and D → A. What is the highest normal form that R satisfies?
- Relation R(Student, Course, Hobby) stores every course a student takes and every hobby they have, independently of each other, producing a full cross-produ...
- What does the acronym ACID stand for in the context of database transaction management?
- What is the primary objective of database normalization?
- A table T(A,B,C) has functional dependencies A→B and B→C. Which statement about A is necessarily true?
- A company needs to schedule a maximum number of meetings in a single conference room. Each meeting `i` has a start time `s_i` and an finish time `f_i`. Onc...
- Transaction T1 holds a lock on resource A and requests a lock on resource B. Transaction T2 holds a lock on resource B and requests a lock on resource A. B...
- Which SQL isolation level allows phantom reads but prevents dirty reads and non-repeatable reads?
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)