What is Linked List ?
- Linked list is a linear Data structure.
- Linked list is Non-contiguous.
- Linked list is dynamic in size.
- A Linked List consist of the series of Nodes Where a node contains the data and the reference of the another Node.
Why to Use Linked List?
As we Know that Array is of fixed size. if we have the data and we dont know the size so we can use linked list to store.
- Linked list is dynamic that's why we can insert data while the memory full.
2. With the Use of LL we can implement Stack and Queues.
3. Undo Functionality etc.
Example :-
Implementation of the Singly LL :-
We have Discussed Implementation of the Singly Linked List.
Important Ques of the LinkedList:-
Ques 1: Delete Kth Node from the last of the LL.
Ques 2 : Find The Length Of the Linked List or How Many Nodes Are Present in the LL :-
Ques 3:- Find Middle Node In the LL.
Ques 4:- Delete The Middle Node :-
Ques 5 :- Detect The Cycle in The LL.
Ques 6. Reverse a LL.
Ques 7. Find Palindrome of a LL.
Solution :-
- Find the middle of the linked list.
- Reverse the second half of the linked list.
- Compare the first half of the original linked list with the reversed second half.
Ques 8:- Split a linked List into Two Parts : -