A linked list is a linear data structure that contains a series of connected nodes. Each node contains data and the address of the next node.
Linked list can be of singly, doubly and circular types. In this article, we will focus on the implementations of singly linked list.
Before moving on the code, let’s have a look at the time and space complexity of the linked list:
Time Complexity:
Search -> O(n) in worst and average case
Insert -> O(1) in worst and average case
Delete -> O(1) in worst and average case
Space Complexity: O(n)
Singly Linked List implementations in C#:
Output: