Problem
Implement quick sort on singly linked list.
Solution
- Worst case time complexity of quick sort is O(n^2) but it’s rare.
- Quick sort follows divide and conquer approach.
- Quick sort is preferred over merge sort as quick sort is an
Implement quick sort on singly linked list.
Add 2 numbers which are expressed as singly linked lists. Results also should be in a linked list.
Merge 2 singly linked lists which are sorted. The resultant one shall also be in sorted order.
Identifying if there is any loop in singly linked list. Loop meaning any node connecting to one of the previous nodes.
Reverse a singly linked list in linear time complexity.
package… read the rest.
Find the middle element in a singly linked list. Obvious solution is traverse through the list once to find the length of list and then find out the middle element. This takes > O(n). Objective here is to Implement … read the rest.
Swap any two nodes in a singly linked list. It’s not swapping the content of the nodes but the nodes itself.