Day 27: Important Question

Hello Dear Students,
Hope you all are doing good.

Aaj hum ek important question ko understand karenge jo tree data structure ka question hai and last 2 times se exam mein a raha hai. Ye question important and very easy hai.

Let's get started...

Question is-
tree

Question- Here rectangle represents Maximum and Circle represents Minimum. The value of root node of the given tree is?
Option A- 3
Option B- 6
Option C- 7
Option C- 5


So, ise solve karna is very simple and easy. Hume root node ki value ko find out karna hai, so hum kaise karenge?
Firstly, sabse nicche wali nodes ( child nodes) ko dekhenge. Ab, left se shuru karte hain, 
Note:- Rectangle means maximum value from the child nodes and circle means minimum value from the child nodes.
  • So, 4 and 6 mein se maximum is 6, So root rectangle mein 6 a jayega.
  • And aise hi 3 and 7 mein se maximum 7 hai so root rectangle mein 7 a jayega.
  • Ab right mein, 5 and 2 mein se 5 is maximum so uske root rectangle mein 5 a jayega.
  • And 2 and 3 mein se 3 is maximum value, so 3 a jayega root rectangle ki value.
tree data structure

Now, above tree ab aise hoga. So iske root nodes ab circle mein hain, so minimum values fill hongi.
  • 6 and 7 mein se minimum is 6. So iske circle root node mein 6 ayega.
  • 5 and 3 mein se minimum is 3. So, iske circle root node mein 3 ayega.
tree data structure

So, above tree mein jab values fill ho jayengi to wo aise hoga. Ab root node mein value ko fill karna hai, so root node is rectangle means maximum, ab 6 and 3 mein se jo bhi maximum hai wo root node mein ayega. So, 6 is maximum thus the root node has value of 6.

So, The answer is Option B.
tree data structure

Aise 2 questions previous year question papers se aapko daily test mein diye ja rahe hain. So, do give the test for good preparations.


Best of Luck Students,
 Do visit our website regularly for more content and for daily tests.

Regards,
UGC NET EXPERTS