Question
A recursive function calculate_height(node) is designed
to find the height of a binary tree (where a single node has height 0). The function is implemented as: def calculate_height(node):   if node is None:     return -1 # Base case   left_height = calculate_height(node.left)   right_height = calculate_height(node.right)   return 1 + max(left_height, right_height) When tested with a single-node tree (e.g., Node(10)), it returns 0. However, when tested with an empty tree (None), it returns -1. If the desired output for an empty tree is also -1 and for a single node tree is 0, the current implementation is correct. But if the definition of height for a single node tree is 1, what change would be needed in the base case?Solution
(If a single node has height 1, then an empty tree should be 0, and 1 + max(0,0) would give 1 for a single node.)

A right square pyramid has a square base of side 10 cm and vertical height 12 cm. Find:
(i) its volume,
(ii) its slant height,
(iii...
If (x² + 1/x2) = 4, which of the options below is a possible value of x² - 1/x2 ?
The length, breadth and height of a storeroom are 17m, 10m and 12m respectively. If each box occupies 40 m3 of space, then how many boxes can...
Find the coordinates of the points where the graph 57x – 19y = 399 cuts the coordinate axes.
(a) x – axis at (– 7,0) and y – axis at (0, ...
In a right-angled triangle, the hypotenuse is 13 cm and one of the legs is 5 cm. What is the area of the triangle?
If the length of the rectangular pipe is 2 times of its breadth and 5 times of its height. Find the total surface area if its volume is 600 cm³?
A race track is in the shape of a rectangle with length of 25 metres and area of 4500 m2. A car takes 10 seconds to make one lap around the p...
The length of sides of a square is twice the radius of a circle and perimeter of a rectangle is half the perimeter of the square. If the sum of length a...
The length of the rectangle is triple its breadth. If the perimeter of the rectangle is 80 m, then find the area (in m2) of the rectangle.