Introduction
A data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data.
Data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently. A data structure is a special format for organizing and storing data. General data structure types include arrays, files, linked lists, stacks, queues, trees, graphs and so on.
Depending on the organization of the elements, data structures are classified into two types:
- Linear data structures: Elements are accessed in a sequential order but it is not compulsory to store all elements sequentially. Examples: Linked Lists, Stacks and Queues.
- Non–Linear data structures: Elements of this data structure are stored/accessed in a non-linear order. Examples: Trees and graphs.