Question
Given the following code snippet, which operation is
performed on the binary tree to produce the output: 4, 2, 5, 1, 3 ? class Node { int data; Node left, right; Node( int value) { data = value; left = right = null ; } } void traverse (Node root) { if (root == null ) return ; traverse(root.left); System.out.print(root.data + " " ); traverse(root.right); }Solution
The given code performs Inorder Traversal on a binary tree. In this traversal method, the left subtree is visited first, followed by the root node, and finally the right subtree. The recursive calls in the code explicitly follow this order:
- traverse(root.left) visits the left subtree.
- System.out.print(root.data) processes the root node.
- traverse(root.right) visits the right subtree.
Dahi - Handi ” has been Recognised as an Official Sport of which state?
The minimum rate set by the Reserve Bank of India below which the banks are not allowed to lend to its customers is known as
Nanda Kishore Prusty passed away. Who was he?
India became the ___ country to achieve space docking capabilities with the SpaDex mission.
Which of the following pairs is not correctly matched?
What is the main purpose of the Pradhan Mantri Suraksha Bima Yojana (PMSBY)?
Name the commodity exchange which recently launched India's first agri-commodity options in gaur seed
'Iron Fist Drill' was a joint military exercise between USA and:
The Mahanadi River flows through which Indian states?
The Largest Hindu temple in the world is: