Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 3 : The node with data 12 / डेटा 12 वाला नोड

Advertisement

Detailed Solution

सही उत्तर The node with data 12 / डेटा 12 वाला नोड है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

A singly linked list is 5 → 12 → 7 → 20 → NULL. The standard iterative reversal uses three pointers prev, curr and nxt. After exactly TWO iterations of the loop, which node does prev point to? / एकल लिंक्ड सूची 5 → 12 → 7 → 20 → NULL है। मानक पुनरावृत्तीय उत्क्रमण में तीन पॉइंटर prev, curr व nxt प्रयुक्त होते हैं। लूप के ठीक दो पुनरावृत्तियों के बाद prev किस नोड की ओर इंगित करता है?

1.
The node with data 5 / डेटा 5 वाला नोड
2.
The node with data 7 / डेटा 7 वाला नोड
3.
The node with data 12 / डेटा 12 वाला नोड
4.
The node with data 20 / डेटा 20 वाला नोड

Correct Answer: The node with data 12 / डेटा 12 वाला नोड

Iteration 1: prev becomes 5, curr becomes 12. Iteration 2: prev becomes 12, curr becomes 7. So after exactly two iterations prev points to the node with data 12. / पुनरावृत्ति 1: prev = 5, curr = 12। पुनरावृत्ति 2: prev = 12, curr = 7। अतः ठीक दो पुनरावृत्तियों के बाद prev डेटा 12 वाले नोड की ओर इंगित करता है।

Downloaded from PrepSnap (prepsnap.in)