Which of the following data structures is non-linear?
a) Array
b) Linked List
c) Stack
d) Graph
Answer:
d) Graph
Explanation:
A graph is a non-linear data structure consisting of nodes (also called vertices) and edges connecting the nodes. It is used to represent networks, such as social networks or communication networks, where relationships between entities are not hierarchical or sequential.
In contrast, arrays, linked lists, and stacks are linear data structures because their elements are arranged sequentially, and each element is directly accessible in a specific order.
Graphs are widely used in algorithms for network analysis, shortest path calculations, and finding connected components in a system.
Reference:
DSA (Data Structures and Algorithms) MCQ Questions and Answers