Question 22Asked in Bihar STET 2024 Paper II Computer Science, 12 Jun 2024, Shift 1 (10:00 AM)

In the array representation of a binary tree, if the node at index "i" is not null, its left child will be at index:एक बाइनरी ट्री के सरणी प्रतिनिधित्व में, यदि सूचकांक में नोड "i" शून्य नहीं है, तो इसका बायाँ बच्चा सूचकांक में होगा:

एक बाइनरी ट्री के सरणी प्रतिनिधित्व में, यदि सूचकांक में नोड "i" शून्य नहीं है, तो इसका बायाँ बच्चा सूचकांक में होगा:
  1. A2i2i
  2. B2i + 12i + 1
  3. C2i - 12i - 1
  4. Di + 1i + 1
Show answerHide answer

Correct answer: (B) 2i + 12i + 1

Explanation

With 0-based array storage, the node at index i has its left child at 2i + 1 and its right child at 2i + 2. With 1-based storage the left child would be at 2i.0-आधारित array भंडारण में सूचकांक i वाले नोड का बायाँ child 2i + 1 पर और दायाँ child 2i + 2 पर होता है। 1-आधारित भंडारण में बायाँ child 2i पर होता।

From Bihar STET 2024 Paper II Computer Science PYQ, 12 Jun 2024, Shift 1 (10:00 AM)

This is question 22 of Bihar STET 2024 Paper II Computer Science PYQ, 12 Jun 2024, Shift 1 (10:00 AM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.