DATA STRUCTURE
Programming and Technical
Programming
Technical
How would you sort a linked list?
Read Solution (Total 2)
-
- Merge sort is often preferred for sorting a linked list. The slow random-access performance of a linked list makes some other algorithms (such as quicksort) perform poorly, and others (such as heapsort) completely impossible.
- 10 years agoHelpfull: Yes(1) No(1)
- loop 1 from starting pointer to end of the link list
loop 2 this loop compair the every node value to the 1 node after 2 node ....
if the node value is smaller than first then simple interchange it (interchage the node value not the node) - 10 years agoHelpfull: Yes(0) No(1)
DATA STRUCTURE Other Question