Insertion sort, merge sort and quicksort on doubly-linked list Outline: you will implement insertion sort, mergesort and quicksort on a doubly- linked list. You must use the std::list data structure to hold the elements to be sorted (do not provide your own linked list implementation). In addition to the sorting algorithms, you should provide a main with timing experiments to compare the performance of your sorting algorithms on different inputs (lists in sorted order, in reverse-sorted order, with random elements, or all duplicate elements). You should make use of iterators in your code. For example, in the 'merge' function of mergesort you can use an iterator to the left sub-list and a second iterator the right sub-list, and advance the iterator of

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 18PE
icon
Related questions
Question

in C++

Insertion sort, merge sort and quicksort on doubly-linked list
Outline:
you will implement insertion sort, mergesort and quicksort on a doubly-
linked list. You must use the std::list data structure to hold the elements to be sorted (do not
provide your own linked list implementation). In addition to the sorting algorithms, you should provide a
main with timing experiments to compare the performance of your sorting algorithms on different
inputs (lists in sorted order, in reverse-sorted order, with random elements, or all duplicate elements).
You should make use of iterators in your code. For example, in the 'merge' function of mergesort you
can use an iterator to the left sub-list and a second iterator the right sub-list, and advance the iterator of
the appropriate sub-list when it's current element is added to the merged list.
You should also provide an efficient and generic solution through use of templates and move/swap
semantics. Your sorting algorithms should work on lists of any type, and should avoid copying elements
whenever it is possible to move.
Transcribed Image Text:Insertion sort, merge sort and quicksort on doubly-linked list Outline: you will implement insertion sort, mergesort and quicksort on a doubly- linked list. You must use the std::list data structure to hold the elements to be sorted (do not provide your own linked list implementation). In addition to the sorting algorithms, you should provide a main with timing experiments to compare the performance of your sorting algorithms on different inputs (lists in sorted order, in reverse-sorted order, with random elements, or all duplicate elements). You should make use of iterators in your code. For example, in the 'merge' function of mergesort you can use an iterator to the left sub-list and a second iterator the right sub-list, and advance the iterator of the appropriate sub-list when it's current element is added to the merged list. You should also provide an efficient and generic solution through use of templates and move/swap semantics. Your sorting algorithms should work on lists of any type, and should avoid copying elements whenever it is possible to move.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning