Which one is a non-linear data structure?

2019

Which one is a non-linear data structure?

  1. A.

    Stack

  2. B.

    Queue

  3. C.

    Linked List

  4. D.

    Tree

  5. E.

    None of these

Attempted by 1907 students.

Show answer & explanation

Correct answer: D

To determine which data structure is non-linear, we analyze the structure of each option:

1. Stack: Elements are stored in a linear sequence following LIFO (Last In, First Out) order. This makes it a linear data structure.

2. Queue: Elements are stored in a linear sequence following FIFO (First In, First Out) order. This is also a linear data structure.

3. Linked List: Elements are connected via pointers in a linear sequence. Even though memory allocation is dynamic, the structure remains linear.

4. Tree: Elements are organized hierarchically with parent-child relationships. Data does not follow a single sequence; it branches out. This makes it a non-linear data structure.

5. None of these: This option is incorrect because a non-linear data structure (Tree) is present among the choices.

हिन्दी उत्तर:

एक गैर-रैखिक डेटा संरचना का चयन करने के लिए, हम प्रत्येक विकल्प की संरचना का विश्लेषण करते हैं:

1. स्टैक: तत्व LIFO (लास्ट इन, फर्स्ट आउट) क्रम का पालन करते हुए रैखिक क्रम में संग्रहीत होते हैं। इससे यह एक रैखिक डेटा संरचना बनती है।

2. क्यू: तत्व FIFO (फर्स्ट इन, फर्स्ट आउट) क्रम का पालन करते हुए रैखिक क्रम में संग्रहीत होते हैं। यह भी एक रैखिक डेटा संरचना है।

3. लिंक्ड लिस्ट: तत्व पॉइंटर्स के माध्यम से रैखिक क्रम में जुड़े होते हैं। भले ही मेमोरी आवंटन गतिशील हो, संरचना रैखिक रहती है।

4. ट्री: तत्व माता-पिता-बच्चा संबंधों के साथ पदानुक्रमिक रूप से व्यवस्थित होते हैं। डेटा एक एकल क्रम का अनुसरण नहीं करता; यह शाखाएँ बनाता है। इससे यह एक गैर-रैखिक डेटा संरचना बनती है।

5. इनमें से कोई नहीं: यह विकल्प गलत है क्योंकि विकल्पों में एक गैर-रैखिक संरचना (ट्री) मौजूद है।

Explore the full course: Bpsc