Ask Question
22 March, 09:12

Whats an effective way to sort linked lists in cpp.

+5
Answers (1)
  1. 22 March, 09:53
    0
    Using Merge Sort.

    Explanation:

    Merge Sort is preferred for sorting the linked list because the the data stored in linked list is not in serial memory address which makes the quick sort algorithm very slow and other sorting algorithms impossible.

    Merge Sort is a divide and conquer algorithm.

    In this algorithms we divide the linked list into sub parts and sort the sub parts of the linked list and then we merge them in sorted order. It is a very effective approach for linked list sorting.

    The time complexity of merge sort is O (NLogN).
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Whats an effective way to sort linked lists in cpp. ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers