Reverse A Singly Linked List - Everything You Need To Know
Write an algorithm to reverse the given singly linked list. You can use the properties of a stack...
A data structure is a specific way of organizing and storing the data in computers such that we can efficiently perform various operations on it. Data structures are extensively used in computers and software. It is a must know topic for software engineering interviews along with algorithms.
There are various types of data structures. Some of them are listed below. This section describes each of these data structures in detail.
Arrays
Linked Lists
Stacks
Queues
Trees
Heaps
Graphs
Some of these are linear data structures, while others are non-linear. In linear data structures data is arranged in a linear or sequential manner. These are simple to implement and have a unique traversal (Single way to traverse). Examples of linear data structures are linked lists, queues, stacks etc.
Non-linear data structures are hierarchical in nature consisting of multiple levels. We can traverse these data structures in more than one way. Also these are comparatively more complex to implement. Trees, graphs are examples of non-linear data structures.